Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying uploadReadAheadSize in ASP.NET Web.config

Tags:

c#

asp.net

iis

For a problem that I am facing I need to increase the uploadReadAheadSize from 49K to 10M. I am able to change IIS's setting with

appcmd.exe set config "MyWebServicesSite" -section:serverRuntime /uploadReadAheadSize:10485760 /commit:apphost

which results in the applicationhost.config containing:

<location path="MyWebServicesSite" allowOverride="true">
    <system.webServer>
        <serverRuntime uploadReadAheadSize="10485760" />
    </system.webServer>
</location>

However, I am publishing my app to a remote server on which I dont have direct control on IIS's setting.

How can I put this setting in Web.config?

My attempts:

  1. Adding the following inside <system.webServer>

    <serverRuntime uploadReadAheadSize="10485760" />
    

Results: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

  1. Adding the following under <configuration>:

    <location path="EmsPublisherWebServicesSite" allowOverride="true">
        <system.webServer>
            <serverRuntime uploadReadAheadSize="10485760" />
        </system.webServer>
    </location>
    

    Results: No effect

Any help would be appreciated

like image 323
UKM Avatar asked Jan 19 '17 20:01

UKM


People also ask

What is Web config file in ASP NET MVC?

web. config file is an XML-based configuration file used in ASP. NET-based applications to manage various settings that are concerned with the configuration of our website. In this way, we can separate our application logic from configuration logic.

What is Web config in VB net?

For ASP.Net applications, this file is called web. config and is located in the bin folder of the application root. An ASP.Net application can contain more than one web. config files at sub-directory level. For applications hosted by the executable host, the config file has the same name as the application, with a.


2 Answers

If you do not have direct access, maybe you can request the other Admin to change the entry for you. It would be:

<section name="serverRuntime" overrideModeDefault="Allow" />

This matches with your:

<system.webServer>
<serverRuntime uploadReadAheadSize="10485760" />
...
like image 156
Spencer Sullivan Avatar answered Sep 17 '22 21:09

Spencer Sullivan


Run the following command in the command prompt as administrator:

%windir%\system32\inetsrv\appcmd.exe unlock config -section:system.webServer/serverRuntime

See Adding serverRuntime tag in webconfig cause 500.19 error

like image 38
Snok Avatar answered Sep 17 '22 21:09

Snok