InvalidOperationException in Orchard.Mvc.Routes.ShellRoute

Topics: Core, Writing modules
Dec 11, 2012 at 2:25 PM
Edited Dec 11, 2012 at 2:27 PM


After updating to Orchard 1.6 from 1.5.1 my custom module started to throw the following exception:

System.InvalidOperationException: 'HttpContext.SetSessionStateBehavior' can only be invoked before 'HttpApplication.AcquireRequestState' event is raised.

Exception is being thrown in this line of Orchard.Mvc.Routes.ShellRoute:

// push provided session state behavior to underlying MvcHandler

I use telerik controls in my module and commenting out the style and script registars actually makes the exception to go away

@Html.Telerik().StyleSheetRegistrar().DefaultGroup(v => ...)

Also a second clue that I found is that when I'm running my website from ASP.NET Development Server instead of IIS it also makes the exception to go away (with telerik enabled)

Based on the Development Server vs. IIS findings I belive that this might be something with the IIS configuration but honestly I cannot see anything wrong
App pool: Integrated pipeline,.NET 4, Identity: Network Service with access to folder.

Dec 13, 2012 at 2:05 AM

I am experiencing exactly the same issue.

The Telerik code makes a call to RouteTable.Routes.GetRouteData() - I suspect that the change in 1.6 may cause problems for any module that uses GetRouteData.

Dec 24, 2012 at 2:36 PM

I have the same problem ..

how to resolve?

Dec 29, 2012 at 6:15 PM


I have created an issue for this, please vote on it if you want it to be fixed