Question

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 returns a 500 internal server error:

There is a problem with the resource you are looking for, and it cannot be displayed.

Was it helpful?

Solution

Putting it as the answer :)

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

<httpRuntime /> 

as well as

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

OTHER TIPS

The max limit of maxRequestLength is 2 GB (2147483648) and maxAllowedContentLength is 4 GB (4294967295). If you want upload huge files, then you can use some third party tools like Ultimate uploader to upload.

Many times by adding line

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

gives 500 error

Please find out <httpRuntime /> Which is already exists in your web configuration file

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top