How to determine the following default web configuration values?

I get the “Connection is forcibly closed” errors and when examining the permission, I saw money offers with the following web.config parameters that are not currently installed in my web application.

Before I change them, I would like to know what they are installed on.

Can someone tell me how to read these values ​​from .NET code, preferably VB.NET, although C # is fine.

<httpRuntime executionTimeout="90" maxRequestLength="4096" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" /> 
+4
web-config
May 18 '10 at 16:00
source share
3 answers

Here is the MSDN Page listing all the values ​​and their default value.

The following code will open the httpRuntime programccly

 Configuration config = WebConfigurationManager.OpenWebConfiguration("~"); object o = config.GetSection("system.web/httpRuntime"); HttpRuntimeSection section = o as HttpRuntimeSection; 

This code was found here.

And in VB

 Dim config As Configuration = WebConfigurationManager.OpenWebConfiguration("~") Dim o As Object = config.GetSection("system.web/httpRuntime") Dim section As HttpRuntimeSection = TryCast(o, HttpRuntimeSection) 

Make sure you use / Import the following namespaces.

 System.Configuration; System.Web.Configuration; 

Edit based on comment.

When calling WebConfigurationManager.OpenWebConfiguration From MSDN

path Type: System.String The virtual path to the configuration file. If null, the root Web.config file opens.

Even if you do not have the httpRuntime defined in your web.config, this is the root of the Web.config and this is returned. I checked this with and without httpRuntime definition.

+6
May 18 '10 at 16:03
source share

the MSDN documentation contains values ​​and default values ​​for this :)

If you are interested in other web.config / meaning / default values, start with the <configuration> schema and go to what you need. For quick reference (.Net 4 values):

 <httpRuntime executionTimeout="110" maxRequestLength="4096" requestLengthDiskThreshold="80" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="5000" enableKernelOutputCache="true" enableVersionHeader="true" requireRootedSaveAsPath="true" enable="true" shutdownTimeout="90" delayNotificationTimeout="5" waitChangeNotification="0" maxWaitChangeNotification="0" requestPriority="Normal" enableHeaderChecking="true" sendCacheControlHeader="true" apartmentThreading="false" /> 
+2
May 18 '10 at 16:02
source share

The default values ​​for a particular installation are stored in the machine.config . To access these values, you can use:

 ConfigurationManager.OpenMachineConfiguration(); 

Get configuration. There may be some security restrictions to access these values.

-one
May 18 '10 at 16:05
source share



All Articles