簡體   English   中英

wcf .net 4.6 iis 7.5 413錯誤

[英]wcf .net 4.6 iis 7.5 413 error

我在從asp.net應用程序/控制台應用程序調用wcf服務時遇到問題。 我收到的錯誤是“遠程服務器返回錯誤:(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>

檢查預讀字節設置。 查看類似問題的答案:

IIS7-(413)請求實體太大| 應將UploadReadAheadSize

如果您發現Tom P或其他人的答案對您有所幫助,請務必對他/她的答案投贊成票。 在應收信貸的地方給予信貸。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM