如果没有Application_Start,请求在此上下文中不可用

时间:2013-03-27 23:01:58

标签: asp.net iis-7

我对使用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的Web服务器部分时,我没有收到任何错误,一切正常。有什么想法吗?

1 个答案:

答案 0 :(得分:0)