【发布时间】:2013-03-18 06:19:34
【问题描述】:
我对使用 Framework 2.0 创建的旧 ASP.NET 应用程序进行了更改。 Global.asax 没有 Application_Start 但是当我在 IIS7 上调试时出现错误
说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.Web.HttpException:请求在此上下文中不可用
来源错误:
在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。
堆栈跟踪:
[HttpException (0x80004005): Request is not available in this context]
System.Web.HttpContext.get_Request() +11207688
Microsoft.Practices.CompositeWeb.Services.WebConfigModuleInfoStore.GetConfiguration(String
configFilePath) +130
Microsoft.Practices.CompositeWeb.Services.WebConfigModuleInfoStore.PopulateSection
(ModulesConfigurationSection section, String rootDirectory) +274
Microsoft.Practices.CompositeWeb.Services.WebConfigModuleInfoStore.GetModuleConfigurationSection
() +103
Microsoft.Practices.CompositeWeb.Services.WebModuleEnumerator.EnumerateModules() +216
Microsoft.Practices.CompositeWeb.WebClientApplication.LoadModules() +443
Microsoft.Practices.CompositeWeb.WebClientApplication.Application_Start(Object sender,
EventArgs e) +262
[HttpException (0x80004005): Request is not available in this context]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
context, HttpApplication app) +4185553
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext,
HttpContext context, MethodInfo[] handlers) +205
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr
appContext, HttpContext context) +336
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext,
HttpContext context) +350
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +382
[HttpException (0x80004005): Request is not available in this context]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11335894
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,
HttpContext context) +4355316
当我切换到 VS 的网络服务器部分进行开发时,我没有收到任何错误,并且一切正常。有什么想法吗?
【问题讨论】:
-
再一次 Global.asax 只包含 Application_Error 而没有其他内容
-
亚历克斯,你从哪里弄明白的?
-
@AlexKu,你是这个人吗...xkcd.com/979你有解决办法吗? :)