Jump to: navigation, search

Difference between revisions of "Configuration Files/web.config"


(Example)
Line 18: Line 18:
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<configuration>
 
<configuration>
<configSections>
+
  <configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
+
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
+
    <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
+
  </configSections>
<loggingConfiguration configSource="Web.Logging.config" />
+
  <loggingConfiguration configSource="Logging.config" />
<exceptionHandling>
+
  <system.web>
<exceptionPolicies>
+
    <compilation debug="true" targetFramework="4.0" />
<add name="System.Exception">
+
    <httpRuntime maxRequestLength="65536"/>
<exceptionTypes>
+
  </system.web>
<add name="All Exceptions" type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+
  <system.serviceModel>
 +
    <behaviors>
 +
      <serviceBehaviors>
 +
        <behavior name="httpBehavior">
 +
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
 +
          <serviceMetadata httpGetEnabled="true" />
 +
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
 +
          <serviceDebug includeExceptionDetailInFaults="true" />
 +
        </behavior>
 +
      </serviceBehaviors>
 +
      <endpointBehaviors>
 +
        <behavior name="httpBehavior">
 +
          <webHttp />
 +
        </behavior>
 +
      </endpointBehaviors>
 +
    </behaviors>
 +
    <bindings configSource="Bindings.config" />
 +
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
 +
    <services configSource="Services.config" />
 +
    <client configSource="Client.config" />
 +
  </system.serviceModel>
 +
  <system.webServer>
 +
    <modules runAllManagedModulesForAllRequests="true" />
 +
    <directoryBrowse enabled="true" />
 +
  </system.webServer>
 +
  <exceptionHandling>
 +
    <exceptionPolicies>
 +
      <add name="System.Exception">
 +
        <exceptionTypes>
 +
          <add name="All Exceptions" type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
 
postHandlingAction="None">
 
postHandlingAction="None">
<exceptionHandlers>
+
            <exceptionHandlers>
<add name="System.Exception" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+
              <add name="System.Exception" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
 
logCategory="EXCEPTION" eventId="100" severity="Error" title="System.Exception"
 
logCategory="EXCEPTION" eventId="100" severity="Error" title="System.Exception"
 
formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
 
formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
 
priority="0" />
 
priority="0" />
</exceptionHandlers>
+
            </exceptionHandlers>
</add>
+
          </add>
</exceptionTypes>
+
        </exceptionTypes>
</add>
+
      </add>
</exceptionPolicies>
+
    </exceptionPolicies>
</exceptionHandling>
+
  </exceptionHandling>
<appSettings configSource="Web.AppSettings.config" />
+
  <appSettings configSource="AppSettings.config" />
<runtime configSource="Web.Runtime.config" />
+
<system.web>
+
<customErrors mode="Off"/>
+
<httpRuntime maxRequestLength="65536" />
+
<compilation debug="true" defaultLanguage="c#" targetFramework="4.0" />
+
</system.web>
+
<system.serviceModel>
+
<behaviors>
+
<serviceBehaviors>
+
<behavior name="httpBehavior">
+
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
+
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
+
<!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
+
<serviceDebug includeExceptionDetailInFaults="true" />
+
<dataContractSerializer maxItemsInObjectGraph="10000000"/>
+
</behavior>
+
</serviceBehaviors>
+
<endpointBehaviors>
+
<behavior name="httpBehavior">
+
<webHttp />
+
<dataContractSerializer maxItemsInObjectGraph="10000000"/>
+
</behavior>
+
</endpointBehaviors>
+
</behaviors>
+
<bindings configSource="Web.Bindings.config" />
+
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" />
+
<services configSource="Web.Services.config" />
+
<client configSource="Web.Client.config" />
+
</system.serviceModel>
+
<system.webServer>
+
<modules runAllManagedModulesForAllRequests="true" />
+
<directoryBrowse enabled="true" />
+
<validation validateIntegratedModeConfiguration="false" />
+
<security>           
+
<requestFiltering>
+
<requestLimits maxAllowedContentLength="524288000"/>
+
</requestFiltering>
+
</security>
+
</system.webServer>
+
<runtime>
+
<assemblyBinding>
+
<dependentAssembly>
+
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="5.0.0.0" />
+
</dependentAssembly>
+
</assemblyBinding>
+
</runtime>
+
 
</configuration>
 
</configuration>
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 14:29, 12 May 2015

This is the main configuration file of the web service (since Version 2.4.3 - Server). The web service is configured using this main configuration file and the specific files.

Sections

Additonal sections in the configuration file, valid only for the web service configuration are

appSettings

See Configuration Files/AppSettings.config.

system.web

This does not have to be edited in general.

system.webServer

This does not have to edited in general, except the setting for the maximum allowed size of received content. This can be changed by editing the value maxAllowedContentLength within the section requestFiltering/requestLimits.

Example

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
  </configSections>
  <loggingConfiguration configSource="Logging.config" />
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime maxRequestLength="65536"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="httpBehavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="httpBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings configSource="Bindings.config" />
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <services configSource="Services.config" />
    <client configSource="Client.config" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <directoryBrowse enabled="true" />
  </system.webServer>
  <exceptionHandling>
    <exceptionPolicies>
      <add name="System.Exception">
        <exceptionTypes>
          <add name="All Exceptions" type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
                                                        postHandlingAction="None">
            <exceptionHandlers>
              <add name="System.Exception" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                                                                        logCategory="EXCEPTION" eventId="100" severity="Error" title="System.Exception"
                                                                        formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                                                                        priority="0" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
    </exceptionPolicies>
  </exceptionHandling>
  <appSettings configSource="AppSettings.config" />
</configuration>

See also