Golf工作室

沧海中的一栗
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

解决"Failed to access IIS metabase"

Posted on 2010-01-22 14:49  Golf工作室  阅读(636)  评论(1编辑  收藏  举报

原因:IIS没有注册

解决办法:

方法一:

在CMD中进入目录C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727,运行aspnet_regiis

1、aspnet_regiis -ga administrator(administrator为当前用户)

2、aspnet_regiis -i (注册IIS)

3、iisreset /noforce (重启IIS)


操作详细:

C:\Documents and Settings\Administrator>cd c:\\windows\\microsoft.net\\framework\\v2.0.50727

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis -ga administrator
Start granting administrator access to the IIS metabase and other directories us
ed by ASP.NET.
Finished granting administrator access to the IIS metabase and other directories
used by ASP.NET.

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis -lv
2.0.50727.0     Valid           C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\as
pnet_isapi.dll

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis -i
Start installing ASP.NET (2.0.50727).
..............
Finished installing ASP.NET (2.0.50727).

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis -lv
2.0.50727.0     Valid (Root)    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\as
pnet_isapi.dll

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>iisreset /noforce

Attempting stop...
Internet services successfully stopped
Attempting start...
Internet services successfully restarted

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>

 方案二:
可以建立一个的bat文件.以下为代码:

@echo off
pause
aspnet_regiis -ga administrator
aspnet_regiis -lv
aspnet_regiis -i
aspnet_regiis -lv
iisreset /noforce
@echo off
pause


将以上文本保存成bat文件.
复制到C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727  后运行

问题详情:

[HostingEnvironmentException: Failed to access IIS metabase.]
   System.Web.Configuration.MetabaseServerConfig.MapPathCaching(String siteID, VirtualPath path) +637
   System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath2.MapPath(String siteID, VirtualPath vpath) +9
   System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +174
   System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath virtualPath, Boolean permitNull) +51
   System.Web.CachedPathData.GetConfigPathData(String configPath) +341
   System.Web.CachedPathData.GetConfigPathData(String configPath) +234
   System.Web.CachedPathData.GetApplicationPathData() +38
   System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +8802175
   System.Web.Configuration.RuntimeConfig.GetLKGRuntimeConfig(VirtualPath path) +117