Graphical modifications to the IIS Web.config configuration file add a default document method _win Server

Source: Internet
Author: User

We found the Web.config file in the published website, open this one, add a few pieces of code inside the <configuration></configuration> tag, you can specify the page that starts by default. <system.webServer>

Copy Code code as follows:

<defaultDocument>
<files>
<add value= "dreyeonlinetestpage.html"/>
</files>
</defaultDocument>
</system.webServer>

So we don't need to manually specify a page as the starting page for the site.
Note: If you have a page in your IIS that is specified in the configuration file, you will get an error if you click the default document under the Web site in IIS, as follows:

This is because you already have this page specified in your site, because the default document is already set in IIS dreyeonlinetestpage.html, and then ASP.net gets another add of the same value that throws an exception.
So you can't add the same value, if you don't have this page in the default document for the site you're building, find it in the default document in the root directory of IIS, like the red circle in the figure:

Click on the item in the red circle, and then find the default document in the function view on the right, and then look for it in this, there is no duplication. Of course you can specify a page, put it inside, and then it will be the default starting page for all sites.
If you're looking for trouble, delete the code that adds the default document from the configuration file, or you can use clear to erase it, and then add it. The code is as follows:

<add/> before joining <clear/>

That is, modify Web.config to

Copy Code code as follows:

<system.webServer>
<defaultDocument>
<files>

<clear/>
<add value= "dreyeonlinetestpage.html"/>
</files>
</defaultDocument>
</system.webServer>

If you do not modify the default document on IIS and change it directly in the config file, it is reflected in IIS as well.

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.