内容类型application / soap + xml;服务不支持charset = utf-8。客户端和服务绑定可能不匹配

时间:2018-06-06 20:11:56

标签: json wcf iis soap https

我使用框架4构建了wvf服务,并使用https托管到IIS。

下面是我的配置文件和我得到的错误

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime />
    <pages controlRenderingCompatibilityVersion="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="WebService.Service1">
        <endpoint address="" binding="webHttpBinding" contract="WebService.IService1" bindingConfiguration="LargeWeb" behaviorConfiguration="webBehavior" />
        <endpoint address="h" binding="basicHttpBinding" contract="WebService.IService1" bindingConfiguration="" behaviorConfiguration="" />

        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding" contract="WebService.IService1"/>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="webBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <bindings>
      <basicHttpBinding>
        <binding name="secureHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </basicHttpBinding>

      <webHttpBinding>
        <binding name="LargeWeb" maxBufferPoolSize="20000000" maxReceivedMessageSize="20000000" maxBufferSize="20000000">
          <readerQuotas maxArrayLength="20000000" maxBytesPerRead="20000000" maxDepth="32" maxNameTableCharCount="20000000" maxStringContentLength="20000000" />
        </binding>
      </webHttpBinding>
    </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <directoryBrowse enabled="false" />
  </system.webServer>
</configuration>

错误返回

Content Type application/soap+xml; charset=utf-8 was not supported by service 
https://www.example.com:55/Service1.svc.  The client and service bindings may be mismatched.

请注意,当我们尝试访问服务表单Windows应用程序

时会返回此错误

0 个答案:

没有答案