Maximum request length exceeded.

Server Error in '/tcms' Application.

Maximum request length exceeded.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: Maximum request length exceeded.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

解决办法(来自网上):

If you are using IIS for hosting your application, then the default upload file size if 4MB. To increase it, please use this below section in your web.config -

<code><span class="tag"><configuration></span><span class="pln"> 
    </span><span class="tag"><system.web></span><span class="pln"> 
        </span><span class="tag"><httpRuntime</span><span class="pln"> </span><span class="atn">maxRequestLength</span><span class="pun">=</span><span class="atv">"1048576"</span><span class="pln"> </span><span class="tag">/></span><span class="pln"> 
    </span><span class="tag"></system.web></span><span class="pln"> 
</span><span class="tag"></configuration></span><span class="pln"> 
</span></code>

Just to add - If you are using IIS7 then you need to use below lines instead of above -

<code><span class="pln"> </span><span class="tag"><system.webServer></span><span class="pln"> 
   </span><span class="tag"><security></span><span class="pln"> 
      </span><span class="tag"><requestFiltering></span><span class="pln"> 
         </span><span class="tag"><requestLimits</span><span class="pln"> </span><span class="atn">maxAllowedContentLength</span><span class="pun">=</span><span class="atv">"1048576"</span><span class="pln"> </span><span class="tag">/></span><span class="pln"> 
      </span><span class="tag"></requestFiltering></span><span class="pln"> 
   </span><span class="tag"></security></span><span class="pln"> 
 </span><span class="tag"></system.webServer></span><span class="pln"> </span></code>

===================================================================================================================

<?xml version="1.0" encoding="utf-8"?>

<!--
  有关如何配置 ASP.NET 应用程序的详细信息,请访问
  http://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration>
  <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" />
    <!-- SqlServer连接字符串:Server=服务器地址;Database=库名;Uid=用户;Pwd=密码-->
 
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"  requestValidationMode="2.0" maxRequestLength="1048576" maxQueryStringLength="102400"  />
    
    <!--  requestValidationMode="2.0"加用户在页面上提交表单到服务器时,服务器会检测到一些潜在的输入风险,例如使用富文本编辑器控件-->
  </system.web>
  <!--<httpRuntime maxRequestPathLength="360" maxQueryStringLength="102400" />-->
  <!--引用外部地址长度-->
  <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.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.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="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>


<system.webServer> 
   <security> 
      <requestFiltering> 
         <requestLimits  maxQueryString="1024000" maxAllowedContentLength="1048576" /> 
      </requestFiltering> 
   </security> 
 </system.webServer> 



</configuration>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值