SSC SSC - 3 months ago 31
ASP.NET (C#) Question

maxRequestLength in web.config makes an internal error

Hi guys i want to allow my users to upload files with huge size so i change my web.config to this :

<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>


Before adding this part my code is worked but after adding the the last 3 lines my website return a 500 internal server error There is a problem with the resource you are looking for, and it cannot be displayed.

Answer

Putting it as the answer :)

You've declared httpRuntime twice in your config. You have

<httpRuntime /> 

as well as

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