C# WCF服务在第一次加载时响应413
我有一个莫名其妙的问题,我找不到答案。我正在尝试将大量数据上载到WCF服务,在第一次和后续尝试中,它将返回413错误,直到在接受大量数据请求后发送64kb限制下的请求为止。 我已经在绑定中扩展了maxReceivedMessageSize和maxStringContentLength元素,这解决了在初始小请求之后发送请求时的问题(如果没有扩展这些元素,则返回不同的错误400,而不是413) 我的系统是在IIS 7上运行的ASP.NET 3.5应用程序,WCF服务使用自定义绑定、SOAP消息和客户端/服务器证书 基本上,复制顺序如下(在2台服务器上测试)C# WCF服务在第一次加载时响应413,c#,asp.net,wcf,wcf-binding,C#,Asp.net,Wcf,Wcf Binding,我有一个莫名其妙的问题,我找不到答案。我正在尝试将大量数据上载到WCF服务,在第一次和后续尝试中,它将返回413错误,直到在接受大量数据请求后发送64kb限制下的请求为止。 我已经在绑定中扩展了maxReceivedMessageSize和maxStringContentLength元素,这解决了在初始小请求之后发送请求时的问题(如果没有扩展这些元素,则返回不同的错误400,而不是413) 我的系统是在IIS 7上运行的ASP.NET 3.5应用程序,WCF服务使用自定义绑定、SOAP消息和客户
- IIS7工作进程启动
- 发送大于64kb的请求:返回413错误
- 发送任何大于64kb的请求:返回413错误
- 发送小于64kb的请求:返回200个有效的soap响应
- 发送大于64kb的请求:返回200个有效soap响应
- IIS7工作进程启动
- 发送大于64kb的请求:返回413错误
- 发送任何大于64kb的请求:返回413错误
- 发送小于64kb的请求:返回200个有效的soap响应
- 发送大于64kb的请求:返回400错误
<system.web>
<httpRuntime maxRequestLength="65536" executionTimeout="1800"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="67108864" />
</requestFiltering>
</security>
</system.webServer>
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceTlsBehavior" name="ELSLookupServiceTLS">
<endpoint address="" binding="customBinding" bindingConfiguration="TlsBinding" contract="Lookup" />
</service>
</services>
<bindings>
<customBinding>
<binding name="TlsBinding" closeTimeout="00:04:00" openTimeout="00:12:00" receiveTimeout="00:15:00" sendTimeout="00:05:00">
<textMessageEncoding>
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
</textMessageEncoding>
<httpsTransport requireClientCertificate="true" maxReceivedMessageSize="6553600" maxBufferPoolSize="6553600" maxBufferSize="6553600" />
</binding>
</customBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceTlsBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="6553600"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
好的,我发现了这个问题,为了便于参考,如果有人遇到这个问题,这里就是它:错误被重新分配到初始SSL流量和IIS,并且似乎与WCF无关(我可能在这方面错了) 必须增加IIS中的uploadReadAheadSize设置 在IIS7中,您可以在serverRuntime元素下的web.config中对其进行扩展,请参见: 在IIS6中,它也可能会弹出,显然是每个站点的IIS设置
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
public class ELSLookupService : Lookup
{
//serivce call implemented here
}