错误 "Request entity too large" - 所有属性都具有最高值
Error "Request entity too large" - all properties have top values
我正在尝试使用 WCF 服务,但收到 HTTP 413 错误 "Request entity too large"。
我使用以下内容配置了 WCF 服务的 web.config:
<system.serviceModel>
<services>
<service name="MyCompany.WCF.Payments.SWPayments" behaviorConfiguration="behaviorPayments">
<endpoint binding="basicHttpBinding" contract="MyCompany.WCF.Payments.Contract.ISWPayments" address="">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="behaviorPayments">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_Payments" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<client>
<endpoint address="http://server:port/MyCompanyWCFPayments/Payments.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Payments" contract="MyCompany.WCF.Payments.Contract.ISWPayments" name="BasicHttpBinding_Payments" />
</client>
</system.serviceModel>
如您所见,属性值设置为最高值。但是我收到 HTTP 413 错误。
我是不是漏掉了什么?
提前致谢并致以最诚挚的问候。期待您对以上的评论。
服务器和客户端好像在同一台机器上。我们至少应该确保在服务器中应用了绑定配置。此外,请不要忘记使用 BindingConfiguration 属性.
将配置应用于服务器的绑定配置
<services>
<service name="MyCompany.WCF.Payments.SWPayments" behaviorConfiguration="behaviorPayments">
<endpoint bindingConfiguration="BasicHttpBinding_Payments" binding="basicHttpBinding" contract="MyCompany.WCF.Payments.Contract.ISWPayments" address="">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
如果问题仍然存在,请随时告诉我。
我正在尝试使用 WCF 服务,但收到 HTTP 413 错误 "Request entity too large"。
我使用以下内容配置了 WCF 服务的 web.config:
<system.serviceModel>
<services>
<service name="MyCompany.WCF.Payments.SWPayments" behaviorConfiguration="behaviorPayments">
<endpoint binding="basicHttpBinding" contract="MyCompany.WCF.Payments.Contract.ISWPayments" address="">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="behaviorPayments">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_Payments" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<client>
<endpoint address="http://server:port/MyCompanyWCFPayments/Payments.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Payments" contract="MyCompany.WCF.Payments.Contract.ISWPayments" name="BasicHttpBinding_Payments" />
</client>
</system.serviceModel>
如您所见,属性值设置为最高值。但是我收到 HTTP 413 错误。
我是不是漏掉了什么?
提前致谢并致以最诚挚的问候。期待您对以上的评论。
服务器和客户端好像在同一台机器上。我们至少应该确保在服务器中应用了绑定配置。此外,请不要忘记使用 BindingConfiguration 属性.
将配置应用于服务器的绑定配置<services>
<service name="MyCompany.WCF.Payments.SWPayments" behaviorConfiguration="behaviorPayments">
<endpoint bindingConfiguration="BasicHttpBinding_Payments" binding="basicHttpBinding" contract="MyCompany.WCF.Payments.Contract.ISWPayments" address="">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
如果问题仍然存在,请随时告诉我。