“/”应用程序中的服务器错误。

对路径“C:\Person\wwwroot\log\2024-03”的访问被拒绝。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.UnauthorizedAccessException: 对路径“C:\Person\wwwroot\log\2024-03”的访问被拒绝。

ASP.NET 无权访问所请求的资源。请考虑对 ASP.NET 请求标识授予访问此资源的权限。ASP.NET 有一个在应用程序没有模拟时使用的基进程标识(通常,在 IIS 5 上为 {MACHINE}\ASPNET,在 IIS 6 和 IIS 7 上为网络服务,在 IIS 7.5 上为配置的应用程序池标识)。如果应用程序正在通过 <identity impersonate="true"/> 模拟,则标识将为匿名用户(通常为 IUSR_MACHINENAME)或经过身份验证的请求用户。

要将 ASP.NET 访问权限授予某个文件,请在文件资源管理器中右击该文件,选择“属性”,然后选择“安全”选项卡。单击“添加”添加适当的用户或组。突出显示 ASP.NET 帐户,选中所需访问权限对应的框。

源错误:

执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。

堆栈跟踪:


[UnauthorizedAccessException: 对路径“C:\Person\wwwroot\log\2024-03”的访问被拒绝。]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +12601735
   System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost) +12404577
   System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) +88
   System.IO.Directory.CreateDirectory(String path) +34
   AgileCorp.Core.XUtil.Log.LogHelper.WriteLog(String sMsg, String logDir) in E:\003-安捷软件\003-基础平台\001-Dotnet\Web\项目产品开发\001-项目任务管理系统\001-源码\AgileCorp.Core\XUtil\Log\LogHelper.cs:26
   AgileCorp.Core.XUtil.Log.LogHelper.WriteLog(String sMsg) in E:\003-安捷软件\003-基础平台\001-Dotnet\Web\项目产品开发\001-项目任务管理系统\001-源码\AgileCorp.Core\XUtil\Log\LogHelper.cs:44
   AgileCorp.Core.XDB.SqlServer.SqlServerDbAccessor.QueryDataTable(String strSql) in E:\003-安捷软件\003-基础平台\001-Dotnet\Web\项目产品开发\001-项目任务管理系统\001-源码\AgileCorp.Core\XDB\SqlServer\SqlServerDbAccessor.cs:166
   AgileCorp.Core.XDB.SqlServer.SqlServerDbAccessor.QueryDataTable(String tableName, String fieldList, String strWhere, String orderBy) in E:\003-安捷软件\003-基础平台\001-Dotnet\Web\项目产品开发\001-项目任务管理系统\001-源码\AgileCorp.Core\XDB\SqlServer\SqlServerDbAccessor.cs:227
   AgileCorp.CMS.Implement.SqlServer.WebSiteImpl.GetAll(String orgCode) in E:\003-安捷软件\003-基础平台\001-Dotnet\Web\项目产品开发\001-项目任务管理系统\001-源码\AgileCorp.CMS.Implement\SqlServer\WebSiteImpl.cs:423
   AgileCorp.CMS.Service.CMSService.GetAllWebSite(String orgCode) in E:\003-安捷软件\003-基础平台\001-Dotnet\Web\项目产品开发\001-项目任务管理系统\001-源码\AgileCorp.CMS.Service\CMSService.cs:262
   AgileCorp.AppWeb.MvcApplication.RegisterRoutes(RouteCollection routes) in g:\001-项目\048-人口与发展政策研究中心\001-cx\AgileCorp.AppWeb\Global.asax.cs:41
   AgileCorp.AppWeb.MvcApplication.Application_Start() in g:\001-项目\048-人口与发展政策研究中心\001-cx\AgileCorp.AppWeb\Global.asax.cs:150

[HttpException (0x80004005): 对路径“C:\Person\wwwroot\log\2024-03”的访问被拒绝。]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +10100435
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +123
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +181
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +228
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +314

[HttpException (0x80004005): 对路径“C:\Person\wwwroot\log\2024-03”的访问被拒绝。]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10080656
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +99
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +263


版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.8.4075.0