我有代码类似如下:我怎样才能返回裸露的结果返回给WCF客户端
<OperationContract()>
<Description("")>
<WebGet(Bodystyle:=WebMessageBodyStyle.Bare, UriTemplate:="TestConnection")>
Function TestConnection() As String
Public Function TestConnection() As String Implements ITestSvc.TestConnection
WebOperationContext.Current.OutgoingResponse.ContentType = "text/plain"
Return "Connection Success"
End Function
但它返回的是<string xmlns='...'>Connection Success</string>
怎样才可以有唯一的“连接成功”,而无需返回XML包装。我知道我们可以用MessageEncoder做些什么。但是,我想让它在操作级别可用(某些操作需要XML/JSON包装,某些操作不需要)。
任何人都可以帮助我吗?
这很好,它帮助了我,而其他人不,谢谢 – smoothumut 2015-02-14 13:50:53