默认文档在IIS7上突然无法工作

4
我有一个网站,已经在IIS7上运行了大约2个月。我们设置默认文档,在用户访问没有页面的域时加载default.asp页面。突然今天早上,我遇到了错误,无法加载默认文档。如果我键入default.asp,则文件可以正常加载。
错误信息:
模块:DefaultDocumentModule
通知:ExecuteRequestHandler
处理程序:StaticFile
错误代码:0x80070002
这是我的applicationhost.config中的一部分内容:
<system.webServer>

    <asp>
        <cache diskTemplateCacheDirectory="%SystemDrive%\inetpub\temp\ASP Compiled Templates" />
    </asp>

    <defaultDocument enabled="true">
        <files>
            <clear />
            <add value="Default.asp" />
            <add value="Default.htm" />
            <add value="index.htm" />
            <add value="index.html" />
            <add value="iisstart.htm" />
        </files>
    </defaultDocument>

    <directoryBrowse enabled="false" />

    <globalModules>
        <add name="UriCacheModule" image="%windir%\System32\inetsrv\cachuri.dll" />
        <add name="FileCacheModule" image="%windir%\System32\inetsrv\cachfile.dll" />
        <add name="TokenCacheModule" image="%windir%\System32\inetsrv\cachtokn.dll" />
        <add name="HttpCacheModule" image="%windir%\System32\inetsrv\cachhttp.dll" />
        <add name="StaticCompressionModule" image="%windir%\System32\inetsrv\compstat.dll" />
        <add name="DefaultDocumentModule" image="%windir%\System32\inetsrv\defdoc.dll" />
        <add name="DirectoryListingModule" image="%windir%\System32\inetsrv\dirlist.dll" />
        <add name="ProtocolSupportModule" image="%windir%\System32\inetsrv\protsup.dll" />
        <add name="HttpRedirectionModule" image="%windir%\System32\inetsrv\redirect.dll" />
        <add name="ServerSideIncludeModule" image="%windir%\System32\inetsrv\iis_ssi.dll" />
        <add name="StaticFileModule" image="%windir%\System32\inetsrv\static.dll" />
        <add name="AnonymousAuthenticationModule" image="%windir%\System32\inetsrv\authanon.dll" />
        <add name="RequestFilteringModule" image="%windir%\System32\inetsrv\modrqflt.dll" />
        <add name="CustomErrorModule" image="%windir%\System32\inetsrv\custerr.dll" />
        <add name="HttpLoggingModule" image="%windir%\System32\inetsrv\loghttp.dll" />
        <add name="RequestMonitorModule" image="%windir%\System32\inetsrv\iisreqs.dll" />
        <add name="IsapiModule" image="%windir%\System32\inetsrv\isapi.dll" />
        <add name="IsapiFilterModule" image="%windir%\System32\inetsrv\filter.dll" />
        <add name="CgiModule" image="%windir%\System32\inetsrv\cgi.dll" />
        <add name="FastCgiModule" image="%windir%\System32\inetsrv\iisfcgi.dll" />
        <add name="ManagedEngine" image="%windir%\Microsoft.NET\Framework\v2.0.50727\webengine.dll" preCondition="integratedMode,runtimeVersionv2.0,bitness32" />
        <add name="ConfigurationValidationModule" image="%windir%\System32\inetsrv\validcfg.dll" />
        <add name="ManagedEngine64" image="%windir%\Microsoft.NET\Framework64\v2.0.50727\webengine.dll" preCondition="integratedMode,runtimeVersionv2.0,bitness64" />
        <add name="RewriteModule" image="%SystemRoot%\system32\inetsrv\rewrite.dll" />
        <add name="ManagedEngineV4.0_32bit" image="C:\Windows\Microsoft.NET\Framework\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness32" />
        <add name="ManagedEngineV4.0_64bit" image="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness64" />
        <add name="WebDAVModule" image="%SystemRoot%\system32\inetsrv\webdav.dll" />
        <add name="WindowsAuthenticationModule" image="%windir%\System32\inetsrv\authsspi.dll" />
    </globalModules>

我也已经验证了模块在磁盘上的物理存在。我不知道这个服务器上是否有任何更改,并且默认文档肯定一直在昨天之前工作。服务器是Windows Server 2008 x64,带有IIS 7.0。

我已经重启了应用程序池,重新启动了服务器,删除并重新输入了默认文档。错误看起来似乎找不到默认文档模块。

我还能尝试什么?


你尝试过运行Process Monitor工具(http://technet.microsoft.com/en-us/sysinternals/bb896645),然后重启IIS并访问页面吗?这将显示它正在尝试读取和失败的确切路径。(正如你所知,0x80070002 == ERROR_FILE_NOT_FOUND。) - Rup
我正在查看进程监视器,但是有太多的信息,我不知道该看什么。你能帮我吗?我设置了一个筛选条件,进程名称=“w3wp.exe”,结果不为“SUCCESS”。每秒仍然会得到数百个命中结果。这是在生产Web服务器上的情况。我应该过滤某个操作,还是有其他方法可以限制筛选,以便我知道要寻找什么? - Stephen
顺便问一下 - 看起来iis会在每个请求的末尾添加\ web.config? 这正常吗? 我看到了我想要访问的路径与default.asp,但就在它访问该页面之前,它尝试了default.asp \ web.config。 它对每个文件都这样做,每次都返回PATH NOT FOUND.. - Stephen
1个回答

10

我和同事整个早上一直在追查这个问题,后来IRC上的一位用户给我们提供了解决方法。原来是因为网站根目录被标记为“隐藏”导致IIS无法处理默认文档。显然,当文件夹被标记为隐藏时,默认文档模块找不到它,就会出现以上所示的ERROR_FILE_NOT_FOUND错误。
我们在一个开发服务器上验证了这种行为,将Web根文件夹设置为隐藏,结果确实出现了默认文档的相同错误。移除“隐藏”属性后,默认文档可以正确加载。

今天我看到很多关于这个问题的提问,但没有人发布适合我们问题的答案。我想感谢在IRC上提供帮助的那位用户!希望这篇文章能够帮助其他人。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接