Configure the subdirectory Web. config to eliminate inheritance, iis7.0 set the route

Source: Internet
Author: User
Tags blogengine connectionstrings

iis7.0 set routing, URL steering, pseudo-static

<system.webServer>
<modules runallmanagedmodulesforallrequests= "true"/>
</system.webServer>

Configure the subdirectory Web. config to eliminate inheritance

Instead of modifying the Web. config file for the root directory, modify the subdirectory's Web. config. Assuming that the root directory's Web. config has a connection string named BlogEngine, to use another connection string named BlogEngine in the subdirectory, you need to first clear the existing connection string (the root directory inherits the ConnectionString settings), clear all the configuration, you can use the clear syntax, clear the configuration of the specified name, you can use the Remove syntax, as follows

<-- The root directory of Web. config-<connectionStrings> <name= "  ConnectionString= "providerName="System.Data.SqlClient "/></  ConnectionStrings>               
<--Web. config for subdirectories (Clear method)-<connectionStrings> <clear/> <add name= "blogengine" connectionString= "Data source=localhost\sqlexpress; Initial Catalog=blogengine2; User id=xxx; Password=xxx " providerName="System.Data.SqlClient "/></connectionStrings> 
<--Web. config for subdirectories (remove method)-<connectionstrings> <remove name= "blogengine "/> <add  Name= "blogengine" =" data source=localhost\sqlexpress; Initial Catalog=blogengine2; User id=xxx; Password=xxx "providername=" /></connectionstrings< Span style= "color:blue;" >>                 

This is just an example of using ConnectionString, which can be applied to all nodes that can be configured, and any configuration node can use the clear and remove nodes to clear the inherited configuration before adding a new configuration. This method is more flexible and preserves some common configurations in the root directory Web. config (without having to reset all).

Configure the subdirectory Web. config to eliminate inheritance, iis7.0 set the route

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.