繁体   English   中英

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

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

我有一个很奇怪的问题。 我正在为应用程序使用IIS 7.0集成模式。 (池已集成ASP 2.0)

当我键入www.xyz.com/MainPage.aspx时,它工作正常。 但是,当我使用简单的www.xyz.com时,它不起作用。

我总是得到这个错误

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

我已经将默认文档映射到MainPage.aspx仍然无法正常工作...我的根目录中没有default.aspx页面。 只有Mainpage.aspx,我无法更改...

我的web.config看起来像这样(仅一部分):

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

检查您的web.config并确保没有将default.aspx列为默认页面之一。 回收应用程序池并重新启动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>

您需要通过IISdocument工具将MainPage.aspx添加为默认页面。 您也可以使用IIS7 web.config添加默认文档。

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

我认为此设置已在applicationHost.config级别的IIS7中锁定。 您必须更改根配置gile或使用IIS管理API才能完成此任务。

暂无
暂无

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

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