When I try to open the website, I get this problem and I have no idea whats wrong with it. I have edited the stack trace with it
Server Error in '/' Application.
Request is not available in this context
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Request is not available in this context
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace
below.
Stack Trace:
[HttpException (0x80004005): Request is not available in this context]
System.Web.HttpContext.get_Request() +8806688
labs.shared.config.CFGConstants.InitializeFromHttpContext() +42
labs.shared.config.CFGConstants..ctor() +722
labs.shared.config.CFGConstants.Get() +108
labs.site.framework.FWStateHelper.OnApplicationStart(HttpApplication app) +12
labs.site.Global.Application_Start(Object sender, EventArgs e) +5
[HttpException (0x80004005): Request is not available in this context]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +2724290
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +128
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +188
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +295
System.Web.HttpApplicationFactory.GetPipelineApplicationInstance(IntPtr appContext, HttpContext context) +56
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +231
[HttpException (0x80004005): Request is not available in this context]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8909915
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +333
You are probably doing stuff in the Application_Start event handler. In IIS 7, there is no HttpRequest available at that time, and you shouldn't depend on a request for initializing your application.
If you really need request stuff early in your application's lifespan, you need to catch the first request getting through.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With