4

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.

peterh
  • 11,875
  • 18
  • 85
  • 108
SSC
  • 301
  • 1
  • 4
  • 18
  • 2TB? Seriously? Just quietly, I think you may be a raving loony :-) In any case, you already have a system.web section yup near the top. Are you sure it shouldn't be in there? – paxdiablo Feb 28 '14 at 12:09
  • so i change it to the top ,you mean i shoud put it in the top ?I did that before but the same error – SSC Feb 28 '14 at 12:13
  • As pax said, you've already declared system.web earlier in the config file. Try moving it there. And try reducing the requestlength and execution timeout, those values are completely insane. There is a limit on the maxRequestLength of 2GB. Not too sure about executionTimeout. Oh, just saw your answer Selva, apologies! – BobbyDazzler Feb 28 '14 at 12:31
  • @MightyLampshade i changed it but again same error – SSC Feb 28 '14 at 12:34
  • 1
    You've also declared httpRuntime twice in your config. You have `` as well as `` – BobbyDazzler Feb 28 '14 at 12:40
  • @MightyLampshade it works ,it was because of httpRuntime that i declare 2 times – SSC Feb 28 '14 at 12:54
  • You can make a post as an asnwer – SSC Feb 28 '14 at 12:55

3 Answers3

23

Putting it as the answer :)

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

<httpRuntime /> 

as well as

<httpRuntime maxRequestLength="2000000000" executionTimeout="99999999"/>
BobbyDazzler
  • 1,193
  • 8
  • 21
4

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.

SelvaS
  • 2,105
  • 1
  • 22
  • 31
1

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

tomRedox
  • 28,092
  • 24
  • 117
  • 154
Amol Khandagale
  • 111
  • 2
  • 5