我无法找到此问题的答案。通过调整web.config文件中的一些最大大小设置,大多数类似的帖子精简似乎已被修复。但是,这些建议都没有解决我的问题。WCF错误 - 意外的响应:(400)错误的请求
为了给出更多背景,我将一个asmx Web服务移植到Windows Azure中承载的WCF Web服务。测试期间出现这个问题。如果我在一次调用中将少量事务传递给我的web服务,它往往工作得很好。虽然我的交易规模大约在50-60(交易)时出现这个错误。序列化到XML,文件大小约为300K,所以它没有任何疯狂的大。但它倾向于倾向于尺寸问题。
此外,接通WCF跟踪,我发现下面的例外发生的历史:
从异常System.ServiceModel.ProtocolException:最大消息大小配额用于传入消息(65536)已经被超过。要增加配额,请在适当的绑定元素上使用MaxReceivedMessageSize属性。
在System.ServiceModel.Channels.HttpInput.ThrowHttpProtocolException(字符串消息,HttpStatusCode的StatusCode,字符串状态说明)
在System.ServiceModel.Channels.HttpInput.ThrowMaxReceivedMessageSizeExceeded()
在System.ServiceModel.Channels .HttpInput.ReadBufferedMessage(流的inputStream)
在System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(例外&放大器;放大器; requestException)
在System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext背景下,操作回调)
所以,它看起来好像其中一个设置,如果关在我的web.config,但这里是什么看起来像:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="MetadataEnabled">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata httpGetEnabled="true"/>
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add scheme="http" port="8081"/>
<add scheme="https" port="444"/>
</defaultPorts>
</useRequestHeadersForMetadataAddress>
<dataContractSerializer maxItemsInObjectGraph="111024000"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Bandicoot.Core" behaviorConfiguration="MetadataEnabled">
<endpoint name="HttpEndpoint"
address=""
binding="wsHttpBinding"
bindingConfiguration="wsHttp"
contract="Bandicoot.CORE.IRepricer" />
<endpoint name="HttpMetadata"
address="contract"
binding="mexHttpBinding"
bindingConfiguration="mexBinding"
contract="Bandicoot.CORE.Stack" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Core"/>
</baseAddresses>
</host>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="wsHttp" maxReceivedMessageSize="111024000"
messageEncoding="Text" maxBufferPoolSize="111024000"
textEncoding="UTF-8">
<readerQuotas maxBytesPerRead="111024000"
maxArrayLength="111024000"
maxStringContentLength="111024000"/>
<security mode="None"/>
</binding>
</wsHttpBinding>
<mexHttpBinding>
<binding name="mexBinding"/>
</mexHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
没有人有任何其他建议,或者有在我的web.config,我只是没有看到的东西误配置的?
感谢您的任何建议!
编辑:这是我的客户的app.config设置
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_CORE" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="14194304" maxBufferPoolSize="14194304" maxReceivedMessageSize="14194304"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="1000" maxStringContentLength="111024000"
maxArrayLength="111024000" maxBytesPerRead="1024000" maxNameTableCharCount="111024000" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
编辑:添加另外的客户信息:
<client>
<endpoint address="http://localhost:92/CORE.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_CORE" contract="Core.CORE"
name="BasicHttpBinding_CORE" />
</client>
编辑:尝试改变服务绑定到basicHttpBinding的 - 配置更改:
<basicHttpBinding>
<binding name="basicHttp" maxReceivedMessageSize="111024000"
messageEncoding="Text" maxBufferPoolSize="111024000"
textEncoding="UTF-8">
<readerQuotas maxArrayLength="111024000" maxBytesPerRead="111024000" maxStringContentLength="111024000"/>
<security mode="None" />
</binding>
</basicHttpBinding>
<service name="Bandicoot.Core" behaviorConfiguration="MetadataEnabled">
<endpoint binding="basicHttpBinding"
bindingConfiguration="basicHttp"
contract="Bandicoot.CORE.IRepricer" />
<endpoint address="mex"
binding="mexHttpBinding"
bindingConfiguration="mexBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Core"/>
</baseAddresses>
</host>
</service>
和客户端的应用程序。配置以及供参考:
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_CORE" 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="100000000"
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>
</bindings>
<client>
<endpoint address="http://localhost:92/CORE.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_CORE" contract="Core.CORE"
name="BasicHttpBinding_CORE" />
</client>
和使用**这些设置是你的客户端终端实际上*? – 2010-11-15 19:46:03
你的服务定义了'wsHttpBinding' - 你的客户有'basicHttpBinding'设置.....是那些即使匹配了?此外 - 你没有告诉我们的' ... '你的客户的配置的部分 - 这将是最有趣的! –
2010-11-15 20:44:43
@marc_s - 此客户端配置的大部分只是由Visual Studio中的“添加服务引用”功能自动生成的。由于我们的客户都将消耗该Web服务,这将是可取的,如果他们没有需要破解了一个配置文件,我们的服务工作...这可能是在它自己的另外一个问题,所以现在我只是想获得它工作。我已经发布了我的配置文件的客户端部分。请让我知道,如果你看到任何看起来不正确的东西。谢谢! – Brosto 2010-11-15 21:04:32