I realize this might be a long-shot trying to get an answer in this forum. But I have a little bit of hope that another NCrunch user ran into and solved this problem and can suggest a solution.
I posted this question in StackoverFlow:
I've reviewed all related posts on this topic in StackoverFlow and other forums.
I'm trying to test code modules which use session state using NUnit and NCrunch. So I'm not in the normal ASPX context.
In an NUnit test method:
I create a page object: Page_Obj = New Page()
Then I call a method to be tested and try to pass Page_Obj.Session.
Method_To_Be_Tested(Page_Obj.Session)
Then I get the error listed in the Subject line.
I've updated app.config with all the suggestions I could find:
<system.web>
<httpRuntime targetFramework="4.5"/>
<httpModules>
</httpModules>
<pages enableSessionState="true"></pages>
<sessionState mode="InProc"></sessionState>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="session"></remove>
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition=""/>
</modules>
</system.webServer>
Also, I made sure the ASP.NET Session service was running on my machine.
What else can I do to get a valid Session object in the NCrunch environment?
Thanks, Ed
Build/Test Issues
System.Web.HttpException : Session state can only be used when enableSessionState is set to true,
Started by CoolBreeze on 3,038 views
Remco NCrunch Developer
#12897
07 Dec 2018 23:33 UTC
Hi Ed,
My knowledge of ASP.NET in this area is quite dated, so I'm not sure how much help I can be directly on this. I'm not aware of anything the test runner specifically needs to do in order for the Session to be active ... I was under the impression that these sorts of things were usually arranged by the framework itself and/or setup code in the test.
Do you receive a different result in this test when running it with a non-NCrunch test runner? (i.e. VSTest, or the NUnit console tool).
Something worth trying if you haven't already is to try compatibility mode to see if this is being caused by an NCrunch settings related issue.
My knowledge of ASP.NET in this area is quite dated, so I'm not sure how much help I can be directly on this. I'm not aware of anything the test runner specifically needs to do in order for the Session to be active ... I was under the impression that these sorts of things were usually arranged by the framework itself and/or setup code in the test.
Do you receive a different result in this test when running it with a non-NCrunch test runner? (i.e. VSTest, or the NUnit console tool).
Something worth trying if you haven't already is to try compatibility mode to see if this is being caused by an NCrunch settings related issue.
Post a reply
Log in to reply.