【发布时间】: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。你有
<httpRuntime />和<httpRuntime maxRequestLength="2000000000" executionTimeout="99999999"/>
标签: asp.net web-config