简体   繁体   English

默认页面是MainPage.aspx而不是Default.aspx时的问题

[英]Problem when default page is MainPage.aspx not Default.aspx

I have very strange problem. 我有一个很奇怪的问题。 I'm using IIS 7.0 Integrated mode for my application. 我正在为应用程序使用IIS 7.0集成模式。 (pool is ASP 2.0 integrated) (池已集成ASP 2.0)

It's working fine when i type www.xyz.com/MainPage.aspx. 当我键入www.xyz.com/MainPage.aspx时,它工作正常。 But when i used simple www.xyz.com then its not working. 但是,当我使用简单的www.xyz.com时,它不起作用。

I always get this error 我总是得到这个错误

The resource cannot be found. 
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /intranet/default.aspx

I have mapped default document to MainPage.aspx still its not working... I don't have default.aspx page in root. 我已经将默认文档映射到MainPage.aspx仍然无法正常工作...我的根目录中没有default.aspx页面。 only Mainpage.aspx and I can't change it... 只有Mainpage.aspx,我无法更改...

my web.config looks like this (only part of it :): 我的web.config看起来像这样(仅一部分):

<configuration>
   <system.webServer>
    <defaultDocument>
        <files>
            <clear />
            <add value="MainPage.aspx" />
        </files>
    </defaultDocument>
   </system.webServer>
</configuration> 

Check you web.config and make sure the default.aspx is not listed as one the default pages. 检查您的web.config并确保没有将default.aspx列为默认页面之一。 Recycle the app pool and restart IIS. 回收应用程序池并重新启动IIS。

<system.webServer>
    <defaultDocument>
        <files>
            <remove value="Default.htm"/>
            <remove value="Default.asp"/>
            <remove value="index.htm"/>
            <remove value="index.html"/>
            <remove value="default.aspx"/>
            <remove value="iisstart.htm"/>
            <add value="MainPage.aspx"/>
        </files>
    </defaultDocument>

You need to add MainPage.aspx as default page through IIS 's document facility. 您需要通过IISdocument工具将MainPage.aspx添加为默认页面。 You may also add a default document with IIS7 web.config. 您也可以使用IIS7 web.config添加默认文档。

<configuration>
   <system.webServer>
    <defaultDocument>
        <files>
            <add value="MainPage.aspx" />
        </files>
    </defaultDocument>
   </system.webServer>
</configuration> 

I think this setting is locked in IIS7 on applicationHost.config level. 我认为此设置已在applicationHost.config级别的IIS7中锁定。 You have to change the root config gile or use IIS Administration API do complete this task. 您必须更改根配置gile或使用IIS管理API才能完成此任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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