【问题标题】:maxRequestLength in web.config makes an internal errorweb.config 中的 maxRequestLength 产生内部错误
【发布时间】:2014-02-28 12:03:49
【问题描述】:

我想让我的用户上传大文件,所以我将 web.config 更改为:

     <configuration>
     <configSections>
      <sectionGroup name="applicationSettings"    type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0,    Culture=neutral, PublicKeyToken=" >
        <section name="delegatezanjan.Properties.Settings"    type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0,   Culture=neutral, PublicKeyToken=" requirePermission="false" />
      </sectionGroup>
    </configSections>
        <system.web>
      <compilation debug="true" targetFramework="4.0">
         <assemblies>
          <add assembly="System.Design, Version=4.0.0.0, Culture=neutral,   PublicKeyToken="/>
        </assemblies>
        </compilation>
       <httpRuntime/>
  <httpRuntime maxRequestLength="200000" executionTimeout="99999"/>
    </system.web>
    <system.serviceModel>
      <bindings>
        <basicHttpBinding>
        <binding name="smsSendWebServiceSoap" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://aryanmsg.ir/smsSendWebService.asmx"
        binding="basicHttpBinding" bindingConfiguration="smsSendWebServiceSoap"
        contract="ServiceReference1.smsSendWebServiceSoap" name="smsSendWebServiceSoap" />
    </client>
     </system.serviceModel>
    <applicationSettings>
    <delegatezanjan.Properties.Settings>
      <setting name="delegatezanjan_ir_smsline_webservice_SMS_WebServer_Service"
        serializeAs="String">
        <value></value>
      </setting>
    </delegatezanjan.Properties.Settings>
     </applicationSettings>
     <system.webServer>
      <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="2147483648" />
        </requestFiltering>
      </security>
    </system.webServer>
</configuration>

在添加这部分之前,我的代码可以运行,但在添加最后 3 行之后,我的网站返回 500 内部服务器错误:

你要找的资源有问题,无法显示。

【问题讨论】:

  • 2TB?严重地?只是静静地,我认为你可能是一个疯狂的疯子 :-) 无论如何,你已经在顶部附近有一个 system.web 部分。你确定它不应该在那里吗?
  • 所以我把它改到顶部,你的意思是我应该把它放在顶部?我以前做过,但同样的错误
  • 正如 pax 所说,您已经在配置文件中声明了 system.web。试着把它移到那里。并尝试减少请求长度和执行超时,这些值是完全疯狂的。 maxRequestLength 有 2GB 的限制。不太确定执行超时。哦,刚刚看到你的回答塞尔瓦,抱歉!
  • @MightyLampshade 我改变了它,但同样的错误
  • 您还在配置中声明了两次 httpRuntime。你有&lt;httpRuntime /&gt;&lt;httpRuntime maxRequestLength="2000000000" executionTimeout="99999999"/&gt;

标签: asp.net web-config


【解决方案1】:

把它作为答案:)

您已经在配置中声明了两次 httpRuntime。你有

<httpRuntime /> 

还有

<httpRuntime maxRequestLength="2000000000" executionTimeout="99999999"/>

【讨论】:

    【解决方案2】:

    ma​​xRequestLength 的最大限制为 2 GB (2147483648),ma​​xAllowedContentLength4 GB (4294967295) .如果你想上传大文件,那么你可以使用一些第三方工具,如 Ultimate uploader 来上传。

    【讨论】:

    • 根据数据类型 int,值 2147483648 无效。无效的 int32。最大值为:2147483647
    【解决方案3】:

    多次加行

     <httpRuntime maxRequestLength="214748364" executionTimeout="9999" targetFramework="4.5"/>
    

    给出 500 错误

    请找出&lt;httpRuntime /&gt;在你的web配置文件中已经存在

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-12
      • 2014-12-21
      • 2019-11-29
      • 1970-01-01
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      相关资源
      最近更新 更多