C#限制上传文件大小

1.WebConfig:

<system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" appRequestQueueLimit="100" executionTimeout="80"  maxRequestLength="1048576000" useFullyQualifiedRedirectUrl="false" />
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
    </httpModules>
  </system.web>
  <system.webServer>

<system.webServer>下添加:

<security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1048576000"/>
      </requestFiltering>
    </security>

2.应用程序池:
点击该网站的ASP,打开限制属性,更改最大请求实体主体限制,然后点击应用

猜你喜欢

转载自www.cnblogs.com/tfeblog/p/11606968.html