我的 MVC 站点出现一个奇怪的错误。我的控制器中有一个动作,它响应 {controller}/{action}/{id} 的默认路由 - 在我的例子中是 /Project/Client/{id}。
根据我传递给它的 id,我得到一个错误。关闭 Elmah,这是一个直接的 ASP.NET 404 错误。打开 Elmah 会给我以下信息:
System.Web.HttpException
at System.Web.CachedPathData.GetConfigPathData(String configPath)
at System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp)
at System.Web.HttpContext.GetFilePathData()
at System.Web.HttpContext.GetConfigurationPathData()
at System.Web.Configuration.RuntimeConfig.GetConfig(HttpContext context)
at System.Web.HttpContext.get_ImpersonationToken()
at System.Web.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError)
at System.Web.HttpApplication.ThreadContext.SetImpersonationContext()
at System.Web.HttpApplication.ThreadContext.Enter(Boolean setImpersonationContext)
at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
这只发生在某些 ID 参数上。例如
/Projects/Client/ABC -- works
/Projects/Client/DEF -- works
/Projects/Client/GHI -- 404
/Projects/Client/JKL -- works
等等...
有什么线索吗?