SVC Web服务响应包含额外的双重Qotation



我在ntext字段中存储了一个json,我想在svc(c#)WebService中返回该json,webService,webService get get and websert类型是字符串,如下:

    [WebInvoke(Method = "GET",
       ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "gcwbcc/{cityCode}/{key}")]

,但结果我得到了额外的双重QUANT,也将JSON转换为 "我有两个问题是额外的双重QUANT,第二个是convertint convertint" to "。>

i通过将Web方法的返回类型更改为流来解决它并编写这一简单的代码行:

byte [] resultbytes = encoding.utf8.getBytes(result); WebOperationContext.Current.OutOngonResponse.ContentType =" application/json; charset = utf-8"; 返回新的MemoryStream(结果Bytes);

反应:WCF中返回RAW JSON(字符串)但这是原始指南 https://blogs.msdn.microsoft.com/carlosfigueira/2008/04/17/wcf-raw-programprampramming-model-web/

最新更新