问题描述
我有一个ASP.NET MVC应用程序,有时会在Windows事件日志中的“应用程序”类别下将消息错误抛出以下消息(敏感数据已由其他字符串替换):
事件ID:1309-源:ASP.NET 4.0.30319.0
Event code: 3005
Event message: Excepción no controlada.
Event time: 10/11/2020 11:28:40
Event time (UTC): 10/11/2020 10:28:40
Event ID: dd36b383da324e25b95f955f7d784971
Event sequence: 627
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/2/ROOT-6-132494775147792163
Trust level: Full
Application Virtual Path: /
Application Path: C:\inetpub\wwwroot\MyAspMvcApp\
Machine name: MyServer
Process information:
Process ID: 4316
Process name: w3wp.exe
Account name: MyDomain\MyCustomIdentity
Exception information:
Exception type: DirectoryNotFoundException
Exception message: No se puede encontrar una parte de la ruta de acceso 'C:\inetpub\wwwroot\MyAspMvcApp\bin\AppConfig.config'.
en MyCompany.ApplicationData.Utils.ReadOrdersFolder() en d:\Projects\IntranetModule\Orders\Areas\Order\Controllers\OrderController.cs:línea 37
en MyCompany.Controls.MyController.OnException(ExceptionContext filterContext)
en System.Web.Mvc.Controller.System.Web.Mvc.IExceptionFilter.OnException(ExceptionContext filterContext)
en System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext,IList`1 filters,Exception exception)
en System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__displayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult)
en System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
en System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
en System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
en System.Web.Mvc.Controller.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult,ExecuteCoreState innerState)
en System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
en System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
en System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
en System.Web.Mvc.Controller.<>c.<BeginExecute>b__151_2(IAsyncResult asyncResult,Controller controller)
en System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
en System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
en System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
en System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
en System.Web.Mvc.MvcHandler.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult,ProcessRequestState innerState)
en System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
en System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
en System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
en System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
en System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
en System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
en System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously)
Request information:
Request URL: http://my.aspnetmvcapp.com/Order/Order/ViewOrderAjax
Request path: /Order/Order/ViewOrderAjax
User host address: 172.XX.X.XX
User: MyDomain\oneDomainUser
Is authenticated: True
Authentication Type: Negotiate
Thread account name: MyDomain\MyCustomIdentity
Thread information:
Thread ID: 144
Thread account name: MyDomain\MyCustomIdentity
Is impersonating: False
Stack trace: en MyCompany.ApplicationData.Utils.ReadOrdersFolder() en d:\Projects\IntranetModule\Orders\Areas\Order\Controllers\OrderController.cs:línea 37
en MyCompany.Controls.MyController.OnException(ExceptionContext filterContext)
en System.Web.Mvc.Controller.System.Web.Mvc.IExceptionFilter.OnException(ExceptionContext filterContext)
en System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext,Boolean& completedSynchronously)
Custom event details:
在这一点上,我想要访问的是“ C:\ inetpub \ wwwroot \ MyAspMvcApp \ bin \ AppConfig.config”文件,以便以具体的方式读取将要在其中订购的文件夹路径放置。
AppConfig.config是一个简单的XML文件。此外,路径“ C:\ inetpub \ wwwroot \ MyAspMvcApp \ bin”和配置文件AppConfig.config始终存在。
此错误并非总是发生,仅几次。
我已将C:\ inetpub \ wwwroot \ MyAspMvcApp \上的全部权限授予我的应用程序池标识MyDomain \ MyCustomIdentity,并且还授予了IIS_IUSRS的读取和执行,显示文件夹内容和读取权限。注意:尚未授予IUSR用户访问此文件夹的权限。
任何想法为何会发生这种情况?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)