1

我对使用 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 的网络服务器部分进行开发时,我没有收到任何错误,并且一切正常。有任何想法吗?

4

1 回答 1

0

似乎 PnP 家伙在他们的设计中忽略了这一点:http ://webclientguidance.codeplex.com/workitem/15451 。

此处提供了一种可能的解决方法:http: //msmvps.com/blogs/paulomorgado/archive/2008/03/11/wcsf-2-0-and-iis7-integrated-pipeline-mode.aspx

于 2013-06-24T14:39:32.057 回答