views:

21

answers:

2

I'm trying to move an ASP.Net MVC app from 3.5 to 4.0 but running into issues. The upgrade went smoothly enough and the application runs on the Cassini server but when run on IIS7 the following error is thrown:

[HttpException (0x80004005): User is not available in this context.] System.Web.HttpApplication.get_User() +4640350 System.Web.Handlers.ScriptModule.Init(HttpApplication app) +26 System.Web.Handlers.ScriptModule.System.Web.IHttpModule.Init(HttpApplication context) +15 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +546 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): User is not available in this context.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11523504 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4777557

The app ran/runs fine on IIS7 when using 3.5 - The routing is working and I'm able to break in the Global.asax file going over the routes and setting up the controller factory. I set up a second simple test application to see if this was unique to the app or happening across the board and was able to replicate the error requesting any URL from the test app. I've tweaked and reset any number of IIS configuration settings and tried disabling the ScriptModule, all to no avail.

Any help is appreciated.

A: 

May have something to do with your web.config. Create a new MVC 2 project and compare the web.config with your existing web.config.

Raj Kaimal
A: 

I'm not familiar with those handlers, but based on the error it seems that it could work if you change the Application Pool to run under Classic Mode. Not sure if there is a better fix, but from the message it looks like its accessing User too early which only happens when you are running in Integrated Mode.

CarlosAg