在window server 2008R2环境下,先安装了.net framework 4.0,然后再安装IIS7.5的时候,会报以下错误:
HTTP 错误 500.21 - Internal Server Error
处理程序“RequestHandlerFactory”在其模块列表中有一个错误模块“ManagedPipelineHandler”
按照网上的教程执行C:\Windows\Microsoft.NET\Framework\v4.0.30319下找到了aspnet_regiis.exe -i -enable后
出现信息:
开始安装 ASP.NET (4.0.30319) 并更改 IIS 配置以使用此版本的 ASP.NET。
...................
已完成安装 ASP.NET (4.0.30319),并已更改 IIS 配置以使用此版本的 ASP.NET。
安装程序检测到操作过程中出现了一些错误。有关详细信息,请查看安装程序日志文件 C:\
Users\mustapha\AppData\Local\Temp\ASPNETSetup_00007.log
查看log文件,里面有一个错误:
Failure Changing IIS ApplicationHost.config: IIS7Register failed with HRESULT 800700b7: '当文件已存在时,无法创建该文件。 '
在这个目录下C:\Windows\System32\inetsrv\config找到了applicationHost.config,先改名,再执行“aspnet_regiis.exe -iru”,还是说有错误,查看log,又出现:
Failure Changing IIS ApplicationHost.config: IIS7Register failed with HRESULT 80070002: '系统找不到指定的文件。
在找了很多方法后,最终找到了解决方法:
原来它实际上,对应的ASPNET_REGIIS.EXE不接受的环境变量扩展到Windows目录。所以,当你看applicationHost.config文件中(\ WINDOWS \ SYSTEM32 \ INETSRV \ config下)你会发现这样的事情:
<isapiCgiRestriction>
<add path="%windir%\system32\inetsrv\asp.dll" allowed="true" groupId="ASP" description="Active Server Pages" />
<add path="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
<add path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
<add path="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v4.0.30319 (32-bit)" description="ASP.NET v4.0.30319 (32-bit)" />
<add path="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v4.0.30319 (32-bit)" description="ASP.NET v4.0.30319 (32-bit)" />
<add path="%windir%\system32\inetsrv\webdav.dll" allowed="true" groupId="WEBDAV" description="WebDAV" />
</isapiCgiRestriction>
我们所需要做的,就是把applicationHost.config中的所有 "%windir%" 替换为 “c:\windows”
然后再次执行C:\Windows\Microsoft.NET\Framework\v4.0.30319下找到了aspnet_regiis.exe -i -enable
问题解决