【发布时间】:2017-12-07 02:42:12
【问题描述】:
我在尝试使用我的 MVC 应用程序访问 wcf 中的保存方法时收到“远程服务器返回错误:(413) 请求实体太大”错误,我仔细检查了我的 web.config 一切似乎正确,我这两天一直在尝试解决这个问题,我尝试了我在谷歌上找到的所有东西,但我失败了,请帮我解决这个问题。
这是来自 MVC 应用程序(客户端)的 web.config 中的 system.servicemodel
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="IPersonProfileServiceEndpoint" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
<binding name="IClientAssessmentEndpoint" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="Basic" />
</security>
</binding>
<binding name="ICMSServiceEndpoint" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="Basic" />
</security>
</binding>
<binding name="BasicHttpBinding_ICMSService" />
</basicHttpBinding>
<wsHttpBinding>
<binding name="IPersonProfileServiceEndpoint" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
<binding name="ICMSServiceEndpoint" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
<binding name="IClientAssessmentEndpoint" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://servicetest.iltest.illinois.gov/AGE/PersonProfile/PersonProfileWCFService.svc" binding="wsHttpBinding" bindingConfiguration="IPersonProfileServiceEndpoint" contract="PersonProfileWCFService.IPersonProfileWCFService" name="IPersonProfileServiceEndpoint">
<identity>
<dns value="illinois.gov" />
</identity>
</endpoint>
<endpoint address="http://localhost:24500/Services/ClientAssessmentService.svc" binding="basicHttpBinding" bindingConfiguration="IClientAssessmentEndpoint" contract="ClientAssessmentWCF.IClientAssessment" name="IClientAssessmentEndpoint" />
<endpoint address="http://localhost:24500/Services/CMSService.svc" binding="basicHttpBinding" bindingConfiguration="ICMSServiceEndpoint" contract="CMSService.ICMSService" name="ICMSServiceEndpoint" />
</client>
<behaviors>
<serviceBehaviors>
<behavior name="debug">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<!--<services>
<service name="TestService" behaviorConfiguration="debug" />
</services>-->
下面是我在 wcf 项目(服务器)的 web.config 中的 system.servicemodel
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBindingConfig" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
<!--<wsHttpBinding>
<binding name="wsHttpBindingConfig" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>-->
</bindings>
<services>
<!--<service name="CMS.WCFApp.Services.CaseManagementService" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingConfig" bindingNamespace="http://localhost:24500/Services/CaseManagementService.svc" name="ICaseManagementServiceEndpoint" contract="CMS.WCFApp.ServiceContract.ICaseManagementService">
--><!--<identity>
<dns value="illinois.gov"/>
</identity>-->
<!--
</endpoint>
</service>
<service name="CMS.WCFApp.Services.ClientAssessmentService" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingConfig" bindingNamespace="http://localhost:24500/Services/ClientAssessmentService.svc" name="IClientAssessmentEndpoint" contract="CMS.WCFApp.ServiceContract.IClientAssessment">
-->
<!--<identity>
<dns value="illinois.gov"/>
</identity>--><!--
</endpoint>
</service>-->
<service name="CMS.WCFApp.Services.CMSService.svc" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingConfig" bindingNamespace="http://localhost:24500/Services/CMSService.svc" name="ICMSServiceEndpoint" contract="CMS.WCFApp.ServiceContract.ICMSService">
<!--<identity>
<dns value="illinois.gov"/>
</identity>-->
</endpoint>
</service>
<!--<service name="CMS.WCFApp.Services.CManagementService" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingConfig" bindingNamespace="http://localhost:24500/Services/CManagementService.svc" name="ICManagementServiceEndpoint" contract="CMS.WCFApp.ServiceContract.ICManagementService">
--><!--<identity>
<dns value="illinois.gov"/>
</identity>--><!--
</endpoint>
</service>-->
</services>
【问题讨论】:
-
你能发布你的
<system.serviceModel>配置的其余部分吗?您可能已经定义了绑定,但没有分配绑定,这意味着您获得的是默认值,而不是您的值。另外,请发布服务和客户端 web.configs。
标签: asp.net-mvc wcf