WCF服务400错误的请求 [英] WCF service 400 bad request
问题描述
我创建了一个服务接收大型文件。从那以后,我已经在我的本地IIS7出版它。从那以后,我已经创建了测试客户端与服务的参考。当我试图发送大文件到服务器我有:错误请求(400)
I've created a service to receive large files. After that I've published it on my local IIS7. After that I've created test client with service reference. When I trying to send large file to server I've got: Bad request (400).
服务,异常跟踪: 的最大邮件大小配额传入消息(65536)已被超过。为了增加配额,使用MaxReceivedMessageSize属性相应绑定元素上。
服务器配置:
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="2097151" useFullyQualifiedRedirectUrl="true" executionTimeout="14400"/>
<customErrors mode="Off" /></system.web>
绑定
<wsHttpBinding>
<binding name="wsBufferedHttpsBinding" messageEncoding="Mtom"
maxReceivedMessageSize="11534336" maxBufferPoolSize="524288"
sendTimeout="00:05:00" receiveTimeout="00:05:00" openTimeout="00:05:00" closeTimeout="00:05:00" >
<readerQuotas maxDepth="64" maxStringContentLength="11534336" maxArrayLength="11534336"
maxBytesPerRead="11534336" maxNameTableCharCount="16384" />
</binding>
</wsHttpBinding>
服务
<service name="MyService">
<endpoint address=""
binding="wsHttpBinding"
bindingName="wsBufferedHttpsBinding"
contract="IServiceContract">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<endpoint address="soap12IssuedToken" binding="customBinding"
bindingConfiguration="soap12IssuedToken" name="soap12IssuedToken"
bindingNamespace="http://url"
contract="IServiceContract" />
</service>
这到底错与此服务?我到处设置此消息的大小。
What the hell wrong with this service? I set this message size everywhere.
推荐答案
貌似主要问题是,你的端点不引用绑定配置。因此,您使用的是默认的65536。
Looks like the main problem is that your endpoint does not reference a binding configuration. You are therefore using the default 65536.
有一些其他的东西来检查:
There are a few other things to check:
- 您有您使用的一个,其中maxReceivedMessageSize设置2端点为同一合同?
- 是否在该服务器上? 客户端匹配的配置
- 您可能还需要设置maxBufferPoolSize和maxBufferSize
- You have 2 endpoints for the same contract are you using the one where maxReceivedMessageSize is set?
- Does the configuration on the client match that on the server?
- You may also need to set "maxBufferPoolSize" and "maxBufferSize"
这篇关于WCF服务400错误的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!