2017-04-26 68 views
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> 
+0

請提供更多信息,即至少獲得特定錯誤(消息)。 「我有問題」有點過於通用而無法採取行動。 –

+0

Hi Christian,「遠程服務器返回錯誤:(413)請求實體太大。」 – VinceV

+0

您的請求有多大。嘗試使用fiddler來查看正在發送的消息。 –

回答