简体   繁体   English

远程服务器返回错误:(413)请求实体太大(尝试“每笔在地球上的解决方案”)

[英]The remote server returned an error: (413) Request Entity Too Large (TRIED EVERY SOLUTION ON EARTH)

I am uploading image from MVC project to WCF project. 我正在将图像从MVC项目上传到WCF项目。 It's ok with image file less than or equal to 50 KB but problem for bigger than 50 KB. 图像文件小于或等于50 KB即可,但大于50 KB则存在问题。

I have already increased the size of UploadReadAheadSize of system.webServer > serverRuntime of IIS to 52428800. Didn't work. 我已经将system.webServer> Server的IIS的UploadReadAheadSize的大小增加到52428800。没有用。

Tried with the all maxlength of binding configurations of WCF web.config file. 尝试使用WCF web.config文件的绑定配置的所有最大长度。 Didn't work. 没用

Tried with MOTM encoding type in the WCF web.config file. 在WCF web.config文件中尝试使用MOTM编码类型。 Didn't work. 没用

Below are my configuration files. 以下是我的配置文件。

:::WCF Web.Config::: ::: WCF Web.Config :::

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="AppServerURL" value="AppServer://192.168.12.44:5162/WService_618"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.6" />
    <httpRuntime targetFramework="4.6"/>
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IServiceProWCFService" sendTimeout="00:25:00"
          allowCookies="true" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
          maxReceivedMessageSize="2147483647" transferMode="StreamedRequest" messageEncoding="Mtom">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>    
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <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"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

:::MVC Web.Config::: ::: MVC Web.Config :::

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <sectionGroup name="businessObjects">
      <sectionGroup name="crystalReports">
        <section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null" />
        <section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler" />
      </sectionGroup>
    </sectionGroup>
  </configSections>
  <businessObjects>
    <crystalReports>
      <rptBuildProvider>
        <add embedRptInResource="true" />
      </rptBuildProvider>
      <crystalReportViewer>
        <add key="ResourceUri" value="/crystalreportviewers13" />
      </crystalReportViewer>
    </crystalReports>
  </businessObjects>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="CrystalImageCleaner-AutoStart" value="true" />
    <add key="CrystalImageCleaner-Sleep" value="60000" />
    <add key="CrystalImageCleaner-Age" value="120000" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
    <pages>
      <namespaces>
        <add namespace="Kendo.Mvc.UI" />
      </namespaces>
    </pages>
    <httpHandlers>
      <add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web,Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
    </httpHandlers>
    <sessionState timeout="180"></sessionState>
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IServiceProWCFService" maxBufferSize="2147483647"
          maxReceivedMessageSize="2147483647" receiveTimeout="00:30:00" sendTimeout="00:30:00" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:22918/ServiceProWCFService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IServiceProWCFService"
        contract="ServiceProWCFService.IServiceProWCFService" name="BasicHttpBinding_IServiceProWCFService" />
    </client>
  </system.serviceModel>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>      
    </handlers>
  </system.webServer>
</configuration>

My problem is solved. 我的问题解决了。 I just changed the web.config of WCF. 我只是更改了WCF的web.config。 That's it 而已

  <bindings> <basicHttpBinding> <binding maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" sendTimeout="00:25:00"> <readerQuotas maxDepth="32" maxArrayLength="2147483647" maxStringContentLength="2147483647"/> </binding> </basicHttpBinding> </bindings> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 远程服务器返回错误:(413)请求实体太大 - The remote server returned an error: (413) Request Entity Too Large 远程服务器返回了意外的响应:(413)请求实体太大 - The remote server returned an unexpected response: (413) Request Entity Too Large Exchange Web 服务 - 请求失败。 远程服务器返回错误:(413) 请求实体太大 - Exchange Web Services - The request failed. The remote server returned an error: (413) Request Entity Too Large WCF错误:远程服务器返回错误:(413)请求实体太大 - WCF error: The remote server returned an error: (413) Request Entity Too Large 错误:远程服务器返回了意外的响应:(413)请求实体太大 - Error: the remote server returned an unexpected response: (413) Request Entity Too Large Azure云服务“远程服务器返回错误:(413)请求实体太大。” - Azure Cloud Service “The remote server returned an error: (413) Request Entity Too Large.” WCF服务“远程服务器返回错误:(413)请求实体太大。” - WCF Service “The remote server returned an error: (413) Request Entity Too Large.” WCF 4.5:发生意外错误:远程服务器返回了意外响应:(413)请求实体太大 - WCF 4.5: An unexpected error occurred: The remote server returned an unexpected response: (413) Request Entity Too Large WCF 服务与 30mb 输入字符串 - 远程服务器返回错误:(413)请求实体太大 - WCF service with 30mb input string - The remote server returned an error: (413) Request Entity Too Large 文件上传,远程服务器返回错误:(413) Request Entity Too Large - File Upload, The remote server returned an error: (413) Request Entity Too Large
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM