内容类型application / soap + xml;服务http:// localhost:2022 / CustomerService.svc不支持charset = utf-8。客户端和服务绑定可能不匹配 [英] Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:2022/CustomerService.svc. The client and service bindings may be mismatched

查看:363
本文介绍了内容类型application / soap + xml;服务http:// localhost:2022 / CustomerService.svc不支持charset = utf-8。客户端和服务绑定可能不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI


我是WCF的新手,正在使用VS2013调用使用.NET3.5创建的WCF服务的新项目。我收到以下错误



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



在网上检查但无法找到解决问题的任何解决方案



bellow是我正在处理的应用程序的配置文件



web.config



HI
I am very new to WCF and working on a new project using VS2013 to call a WCF service created using .NET3.5.I get the following error

Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:2022/CustomerService.svc. The client and service bindings may be mismatched

checked on the net but could not find any solution to resolve the issue

bellow is the config files of the application i am working on

web.config

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

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5.1"/>
  </system.web>
  <system.serviceModel>
    <bindings configSource="Configuration\Bindings.config" />
    <behaviors configSource="Configuration\Behaviours.config" />
    <client configSource="Configuration\Client.config" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>





bindings.config



bindings.config

<?xml version="1.0" encoding="utf-8" ?>
<bindings>
  <basicHttpBinding>
    <binding name="basicHttpBinding_MaxLength"

             closeTimeout="00:02:00"

             openTimeout="00:05:00"

             sendTimeout="00:10:00"

             receiveTimeout="00:10:00"

             maxBufferSize="2147483647"

             maxBufferPoolSize="2147483647"

             maxReceivedMessageSize="2147483647"

             transferMode="Buffered"

             messageEncoding="Text"

             textEncoding="utf-8"

             useDefaultWebProxy="true"

             hostNameComparisonMode="StrongWildcard">

      <readerQuotas maxStringContentLength="2147483647"

                    maxArrayLength="2147483647"

                    maxBytesPerRead="4096"

                    maxNameTableCharCount="16384"

                    maxDepth="32" />
      <security mode="None" />
    </binding>


  </basicHttpBinding>
</bindings>



behaviours.config


behaviours.config

<?xml version="1.0" encoding="utf-8" ?>
<behaviors>
  <endpointBehaviors>
    <behavior name="EndpointBehavior">
      <!--<InlineWsdl />-->
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="DebugServiceBehavior">
      <serviceThrottling maxConcurrentCalls="256" maxConcurrentSessions="160" />
      <serviceMetadata httpGetEnabled="false"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
    <behavior name="ReleaseServiceBehavior">
      <serviceThrottling maxConcurrentCalls="256" maxConcurrentSessions="160" />
      <serviceMetadata httpGetEnabled="false" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
    <behavior>
      <serviceThrottling maxConcurrentCalls="256" maxConcurrentSessions="160" />
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>





客户端web.config文件







client web.config file


<bindings>
<basicHttpBinding>
	<binding name="ExceptionLoggingServicesSoap" closeTimeout="00:01:00"

		openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

		allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

		maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

		messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

		useDefaultWebProxy="true">
		<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

			maxBytesPerRead="4096" maxNameTableCharCount="16384" />
		<security mode="None">
			<transport clientCredentialType="None" proxyCredentialType="None"

				realm="" />
			<message clientCredentialType="UserName" algorithmSuite="Default" />
		</security>
	</binding>
	<binding name="SearchSoap" closeTimeout="00:01:00" openTimeout="00:01:00"

		receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"

		bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

		maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

		messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

		useDefaultWebProxy="true">
		<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

			maxBytesPerRead="4096" maxNameTableCharCount="16384" />
		<security mode="None">
			<transport clientCredentialType="None" proxyCredentialType="None"

				realm="" />
			<message clientCredentialType="UserName" algorithmSuite="Default" />
		</security>
	</binding>
</basicHttpBinding>
<wsHttpBinding>
	<binding name="WSHttpBinding_IStatementService" closeTimeout="00:01:00"

		openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

		bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"

		maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"

		messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"

		allowCookies="false">
		<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"

			maxBytesPerRead="4096" maxNameTableCharCount="16384" />
		<reliableSession ordered="true" inactivityTimeout="00:10:00"

			enabled="false" />
		<security mode="Message">
			<transport clientCredentialType="Windows" proxyCredentialType="None"

				realm="" />
			<message clientCredentialType="Windows" negotiateServiceCredential="true"

				algorithmSuite="Default" establishSecurityContext="true" />
		</security>
	</binding>
<binding name="WSHttpBinding_IOrderTrackingService" closeTimeout="00:01:00"

	  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

	  bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"

	  maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"

	  messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"

	  allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"

			maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"

			enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"

				realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"

				algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>



Appriciate all your help


Appriciate all your help

推荐答案

Resolve the issue

and posting as it may help some one else as well. The issue was
Resolve the issue
and posting as it may help some one else as well. The issue was
<endpoint name="Services.CustomerService" address="http://localhost:2022/CustomerService.svc" contract="Common.Interfaces.ICustomerService" binding="basicHttpBinding" />



where the binding was set to wsH ttpBinding as the client sends back a xml/test.


where the binding was set to wsHttpBinding as the client sends back a xml/test.


这篇关于内容类型application / soap + xml;服务http:// localhost:2022 / CustomerService.svc不支持charset = utf-8。客户端和服务绑定可能不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆