我無法找到此問題的答案。通過調整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