请求是不是在这方面可用的 [英] Request is not available in this context
问题描述
我运行IIS 7集成模式,我收到
I'm running IIS 7 Integrated mode and I'm getting
请求不可用在这种情况下
当我尝试访问它在从的Application_Start
称为log4net的相关功能。这是code线我已经
when I try to access it in a Log4Net related function that is called from Application_Start
. This is the line of code I've
if (HttpContext.Current != null && HttpContext.Current.Request != null)
和一个异常被抛出了第二个比较。
and an exception is being thrown for second comparison.
还有什么可以等我检查检查比对HttpContext.Current.Request空??
What else can I check other than checking HttpContext.Current.Request for null??
有一个类似的问题被张贴@
<一href=\"http://stackoverflow.com/questions/2056398/request-is-not-available-in-this-context-exception-when-runnig-mvc-on-iis7-5\">http://stackoverflow.com/questions/2056398/request-is-not-available-in-this-context-exception-when-runnig-mvc-on-iis7-5
A similar question is posted @ http://stackoverflow.com/questions/2056398/request-is-not-available-in-this-context-exception-when-runnig-mvc-on-iis7-5
但没有相关的答案有两种。
but no relevant answer there either.
推荐答案
请参阅<一个href=\"http://mvolo.com/iis7-integrated-mode-request-is-not-available-in-this-context-exception-in-applicationstart/\">IIS7集成模式:请求不可用在的Application_Start 这种情况下例外:
Please see IIS7 Integrated mode: Request is not available in this context exception in Application_Start:
请求不在此可用
背景的例外就是就越会
您可能会收到时常见错误
移动ASP.NET应用程序
在IIS 7.0集成模式。这个
例外发生在你
实施
Application_Start方法中的
Global.asax文件,如果你试图
访问请求的HttpContext的
启动应用程序。
The "Request is not available in this context" exception is one of the more common errors you may receive on when moving ASP.NET applications to Integrated mode on IIS 7.0. This exception happens in your implementation of the Application_Start method in the global.asax file if you attempt to access the HttpContext of the request that started the application.
这篇关于请求是不是在这方面可用的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!