简体   繁体   中英

When publishing a web site, my default document name keeps getting removed from IIS

I have an ASP.NET web site project, which I'm publishing to IIS on my Win2k8 R2 server. It has a default page called login.aspx . I set that up on the published web site.

Trouble is, every time I publish a new version of the web site, the login.aspx entry gets erased from the "Default Document" settings of the web site in IIS. This is very annoying. How can I publish my web site from Visual Studio without wiping out the default page every time?

Try putting a defaultDocument in your site's web.config:

<system.webServer>
    <!-- your other stuff -->

    <defaultDocument enabled="true">   
       <files>      
           <clear/>                 
           <add value="login.aspx"/>  
       </files>
    </defaultDocument>

</system.webServer>

You are probably using "sub site", and the default document list of the root website is blank.

Try adding default document (even dummy) to the root website and see if it helps.

(Taken from here: http://forums.iis.net/t/1169880.aspx )

when the login.aspx is added to subsite. it's type 'local'. it gives this error. you should add this page to the servere itself. click the server and then choose the feature view--> iis--- default document then right click to add your "login.aspx" page.

now you should see this in default document of all your sub sites and it will not be erased in publish or server restart.

this is my personal exceperience

Omar kamel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM