【发布时间】:2011-04-25 01:26:00
【问题描述】:
我的代码如下:
<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 包装器,而某些操作不需要)。
谁能帮我解决这个问题?
【问题讨论】: