0
我在从asp.net应用程序/控制台应用程序调用wcf服务时遇到问题。我得到的错误是“远程服务器返回错误:(413)请求实体太大。”wcf .net 4.6 iis 7.5 413错误
双方的web.config和app.config中有下面几行:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IWCLService" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://[server]/[projectname].wcfservice/WCLService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWCLService" contract="wclSvc.IWCLService" name="BasicHttpBinding_IWCLService" />
</client>
</system.serviceModel>
这是WCF服务本身的web.config文件:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6" />
<httpRuntime maxRequestLength="104857600" targetFramework="4.6" />
<customErrors mode="Off" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
<staticContent>
<mimeMap fileExtension=".svc" mimeType="application/octet-stream" />
</staticContent>
<handlers>
<add name="svc-integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler" resourceType="File" preCondition="integratedMode" />
</handlers>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="104857600" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
请提供更多信息,即至少获得特定错误(消息)。 “我有问题”有点过于通用而无法采取行动。 –
Hi Christian,“远程服务器返回错误:(413)请求实体太大。” – VinceV
您的请求有多大。尝试使用fiddler来查看正在发送的消息。 –