遭遇:Access denied to \'c:\\inetpub\\wwwroot\\web.config\'.
自建个人web服务打开后出现如下错误提示:
Server Error in '/myweb' Application.
-----------------------------------------------------------------
Access denied to 'c:\inetpub\wwwroot\web.config'. Failed to start monitoring file changes.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Access denied to 'c:\inetpub\wwwroot\web.config'. Failed to start monitoring file changes.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x***********): Access denied to 'c:\inetpub\wwwroot\web.config'. Failed to start monitoring file changes.]
System.Web.DirectoryMonitor.AddFileMonitor(String file) +381
System.Web.DirectoryMonitor.StartMonitoringFile(String file, FileChangeEventHandler callback, String alias) +76
System.Web.FileChangesMonitor.StartMonitoringFile(String alias, FileChangeEventHandler callback) +322
System.Web.Configuration.HttpConfigurationSystem.AddFileDependency(String file) +139
System.Web.Configuration.HttpConfigurationSystem.ComposeConfig(String reqPath, IHttpMapPath configmap) +503
System.Web.HttpContext.GetCompleteConfigRecord(String reqpath, IHttpMapPath configmap) +434
System.Web.HttpContext.GetCompleteConfig() +48
System.Web.HttpContext.GetConfig(String name) +195
System.Web.CustomErrors.GetSettings(HttpContext context, Boolean canThrow) +20
System.Web.HttpResponse.ReportRuntimeError(Exception e, Boolean canThrow) +40
System.Web.HttpRuntime.FinishRequest(HttpWorkerRequest wr, HttpContext context, Exception e) +480
----------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
参考答案:"Access denied " 就是不允许打开读写web.config
"c:\inetpub\wwwroot\web.config"
文件夹和文件应当设置为允许任何人(即服务器)都可以读写.