[SOLVED] Request is not available in this context

Issue

I’m running IIS 7 Integrated mode and I’m getting

Request is not available in this context

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.

What else can I check other than checking HttpContext.Current.Request for null??


A similar question is posted @
Request is not available in this context exception when runnig mvc on iis7.5

but no relevant answer there either.

Solution

Please see IIS7 Integrated mode: Request is not available in this context exception in Application_Start:

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.

Answered By – Andrew Hare

Answer Checked By – Jay B. (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *