Web.config配置文件详解(网站程序员必看)
发表日期:2021-05-28 06:34:31   文章编辑:admin    浏览次数:329
 

以下是IIS 7.0以上版本 Web.config配置文件的基本使用方法。很适合网站程序员参看,由于Web.config在使用很灵活,可以自定义一些节点。所以这里只介绍一些比较常用的节点。

xml version="1.0"?>

 

<configuration>

  

 <configSections>

    <sectionGroup name="system.web.extensionstype="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.3.61026.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632">

      <sectionGroup name="scriptingtype="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.3.61026.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632">

        <section name="scriptResourceHandlertype="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632requirePermission="false"allowDefinition="MachineToApplication"/>

      sectionGroup>

    sectionGroup>

    <section name="rewritertype="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />

 configSections>

 

 

     <appSettings>

 <add key="1value="1" />

 <add key="Taovalue="TeiBeng" />

 appSettings>

 

 

 <connectionStrings>

    <add name="ConnStringconnectionString="Data Source=TAO;Initial Catalog=HBWXDate;User ID=sa;password=sa">add>

    <add name="abcconnectionString="abcdef" />

 connectionStrings>

 

 

 <location path="Default.aspxallowOverride="false">

    

<system.web>

   

    <identity impersonate="false" />

   

   

    <pages masterPageFile="Indextheme="Defaultbuffer="trueenableViewStateMac="truevalidateRequest="falseenableViewState="false">

     

      <controls>controls>

     

      <namespaces>namespaces>

    pages>

   

   

    <customErrors defaultRedirect="Err.htmlmode="RemoteOnly">

     

      <error statusCode="403redirect="NoAccess.htm" />

      <error statusCode="404redirect="FileNotFound.htm" />

    customErrors>

   

   

    <trace enabled="truelocalOnly="falsepageOutput="truerequestLimit="15traceMode="SortByCategory"/>

   

   

    <compilation debug="truedefaultLanguage="c#batch="false">

      <assemblies>

       

        <add assembly="System.Web.Extensions, Version=1.3.61026.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632"/>

        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

        <add assembly="System.Web.Extensions.Design, Version=1.3.61026.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632"/>

        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

        <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

        <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

        <add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

      assemblies>

     

      <buildProviders>

       

        <add extension=".aspxtype="System.Web.Compilation.PageBuildProvider"/>

        <add extension=".ascxtype="System.Web.Compilation.UserControlBuildProvider"/>

        <add extension=".mastertype="System.Web.Compilation.MasterPageBuildProvider"/>

        <add extension=".asmxtype="System.Web.Compilation.WebServiceBuildProvider"/>

        <add extension=".ashxtype="System.Web.Compilation.WebHandlerBuildProvider"/>

        <add extension=".soaptype="System.Web.Compilation.WebServiceBuildProvider"/>

        <add extension=".resxtype="System.Web.Compilation.ResXBuildProvider"/>

        <add extension=".resourcestype="System.Web.Compilation.ResourcesBuildProvider"/>

        <add extension=".wsdltype="System.Web.Compilation.WsdlBuildProvider"/>

        <add extension=".xsdtype="System.Web.Compilation.XsdBuildProvider"/>

        <add extension=".rdlctype="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

      buildProviders>

    compilation>

   

      

    <authentication mode="Forms">

     

      <forms name=".ASPXUSERDEMOloginUrl="Login.aspxprotection="Alltimeout="30"/>

    authentication>

   

    <authorization>

      <allow users="*"/>

      <deny users="weipeng"/>

      <allow users="aaroles="aa" />

    authorization>

   

    <globalization requestEncoding="gb2312responseEncoding="gb2312fileEncoding="gb2312" />

   

    <sessionState mode="InProcstateConnectionString="tcpip=127.0.0.1:42424sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yescookieless="falsetimeout="20">sessionState>

   

    <sessionPageState historySize="9"/>   

   

    <httpRuntime appRequestQueueLimit="100executionTimeout="80maxRequestLength="40960useFullyQualifiedRedirectUrl="false"/>

   

    <httpModules>

      <add name="OutputCachetype="System.Web.Caching.OutputCacheModule" />

      <add name="Sessiontype="System.Web.SessionState.SessionStateModule" />

      <add name="WindowsAuthenticationtype="System.Web.Security.WindowsAuthenticationModule" />

      <add name="FormsAuthenticationtype="System.Web.Security.FormsAuthenticationModule" />

      <add name="PassportAuthenticationtype="System.Web.Security.PassportAuthenticationModule" />

      <add name="RoleManagertype="System.Web.Security.RoleManagerModule" />

      <add name="UrlAuthorizationtype="System.Web.Security.UrlAuthorizationModule" />

      <add name="FileAuthorizationtype="System.Web.Security.FileAuthorizationModule" />

      <add name="AnonymousIdentificationtype="System.Web.Security.AnonymousIdentificationModule" />

     

      <add name="UrlRewritertype="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />

      <add name="Profiletype="System.Web.Profile.ProfileModule" />

    httpModules>

   

    <httpHandlers>

      <remove verb="*path="*.asmx"/>

      <add verb="*path="*.asmxvalidate="falsetype="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632"/>

      <add verb="*path="*_AppService.axdvalidate="falsetype="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632"/>

      <add verb="GET,HEADpath="ScriptResource.axdtype="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632validate="false"/>

      <add verb="POST,GETpath="ajaxpro/*.ashxtype="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>

    httpHandlers>

   

    <httpCookies httpOnlyCookies="falserequireSSL="false"/>

   

    <webServices>

      <protocols>

        <add/>

      protocols>

    webServices>

   

    <caching>

      <cache disableMemoryCollection = "falsedisableExpiration = "falseprivateBytesLimit = "0percentagePhysicalMemoryUsedLimit = "90privateBytesPollTime = "00:02:00"/>

     

      <outputCacheSettings>

        <outputCacheProfiles>

          <add name="ServerOnlyduration="60varyByCustom="browserlocation="Server" />

        outputCacheProfiles>

      outputCacheSettings>

    caching>

     system.web>

 

 location>

 

 <system.net>

 

 <mailSettings>

   <smtp from="weipeng">

    <network host="Gaopassword="" userName="" />

   smtp>

 mailSettings>

  

   <requestCaching disableAllCaching="true">requestCaching>

  

   <defaultProxy>

     <proxy usesystemdefault="Trueproxyaddress="http://192.168.1.10:3128bypassonlocal="True"/>

     <bypasslist>

       <add address="[a-z]+".contoso".com" />

     bypasslist>

   defaultProxy>

 system.net>

 

 <system.webServer>

    <validation validateIntegratedModeConfiguration="false"/>

    <modules>

      <add name="ScriptModulepreCondition="integratedModetype="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632"/>

    modules>

    <handlers>

      <remove name="WebServiceHandlerFactory-Integrated"/>

      <add name="ScriptHandlerFactoryverb="*path="*.asmxpreCondition="integratedModetype="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632"/>

      <add name="ScriptHandlerFactoryAppServicesverb="*path="*_AppService.axdpreCondition="integratedModetype="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632"/>

      <add name="ScriptResourcepreCondition="integratedModeverb="GET,HEADpath="ScriptResource.axdtype="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=1bf38456ad356z632"/>

    handlers>

 system.webServer>

 

 

 <system.web.extensions>

   

    <scripting>

      <webServices>

        <jsonSerialization maxJsonLength="5000"/>

      webServices>

    scripting>

 system.web.extensions>

 

 <system.serviceModel>

    <services>

      <service name="WCFStudent.WCFStudentTextbehaviorConfiguration="ServiceBehavior">

       

        <endpoint address="" binding="wsHttpBindingcontract="WCFStudent.IStuServiceContract">

         

          <identity>

            <dns value="localhost"/>

          identity>

        endpoint>

        <endpoint address="mexbinding="mexHttpBindingcontract="IMetadataExchange"/>

      service>

    services>

    <behaviors>

      <serviceBehaviors>

        <behavior name="ServiceBehavior">

         

          <serviceMetadata httpGetEnabled="true"/>

         

          <serviceDebug includeExceptionDetailInFaults="false"/>

        behavior>

      serviceBehaviors>

    behaviors>

 system.serviceModel>

 

 

 
 
     
     
     
         
         
           
         
         
       
 
         
             
             
         

     
   
 
 
 

标签: Web.config配置
如没特殊注明,文章均为博路网络原创,转载请注明来自https://www.boroad.net/news/changjianwenti/2021/0528/303.html