wcf – 内容类型application/soap xml;服务不支持charset = utf-8

前端之家收集整理的这篇文章主要介绍了wcf – 内容类型application/soap xml;服务不支持charset = utf-8前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我试图添加WCF服务WCFTestClient时收到错误以下错误。我经过网上的解决方案的数量,但不能得到它的工作
有人可以帮助我的问题吗?
我也prviding我的配置文件的服务

Content Type application/soap+xml; charset=utf-8 was not supported by
service The client and service bindings may be mismatched. The
remote server returned an error: (415) Cannot process the message
because the content type ‘application/soap+xml; charset=utf-8’ was not
the expected type ‘text/xml; charset=utf-8

码:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project,the content of the config file 
  must be added to the host's app.config file. System.Configuration does not 
  support config files for libraries. -->
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="basicHttp" allowCookies="true"
                 maxReceivedMessageSize="20000000"
                 maxBufferSize="20000000"
                 maxBufferPoolSize="20000000">
          <readerQuotas maxDepth="32"
               maxArrayLength="200000000"
               maxStringContentLength="200000000"/>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
     <service name="WCFTradeLibrary.TradeService">
        <endpoint address="" binding="basicHttpBinding"
            bindingConfiguration="basicHttp"
            contract="WCFTradeLibrary.ITradeService">          
         </endpoint>
     </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing Metadata information,set the value below to false and remove the Metadata endpoint 
          above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faul`enter code here`ts for 
          debugging purposes,set the value below to true.  Set to false before deployment 
          to avoid disclosing exception info`enter code here`rmation -->
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration>
这里是一个web.config的例子解决我的问题。注意< binding name =“TransportSecurity”messageEncoding =“Text”textEncoding =“utf-8”>
原文链接:https://www.f2er.com/xml/293524.html

猜你在找的XML相关文章