This question is locked. New answers and comments are not allowed.
The OpenAccess setup where the database context object is stored in the Session is not working correctly on our production server. Is there something additional that needs to be configured to get this working? It works on dev machines.
5 Answers, 1 is accepted
0
Hi Scott,
Storing the OpenAccessContext instance in the session state could lead to wrong behavior if there are multiple requests to a page or custom handlers which are using the same session. This could lead to a situation when one request disposes the context before other request are finished doing their work, which will cause an exception. Problems could arise when the application is being used in a web farm.Better approach is to store the context in the HttpContext.Items collection. You could find the sample application, deployed with the Product SDK, helpful. They demonstrate how to handle the context.
Hope that helps.
Kind regards,
Damyan Bogoev
the Telerik team
Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
0
Scott
Top achievements
Rank 2
answered on 28 Feb 2012, 04:42 PM
I got the MVC3 sample from the OpenAccess SDK that stores the context in the Session object... that's why i was doing it that way...
I now see the other sample solution that stores it in the HttpContext.Items collection, and will change it over to that instead, will let you know if i continue to have issues with this method... Thanks!
I now see the other sample solution that stores it in the HttpContext.Items collection, and will change it over to that instead, will let you know if i continue to have issues with this method... Thanks!
0
Scott
Top achievements
Rank 2
answered on 28 Feb 2012, 08:47 PM
Ok, i switched over to using HttpContext.Current.Items, and again it works great on dev machine.... but as soon as I deploy out to production server, it stops working.
I added some logging and found out that the ContextModule : IHttpModule is not even firing the Init... I attached my web.config file... I have the HttpModules section added... please help... thanks in advance! :)
correction i attached screenshots of my web.config file since it doesn't allow anything else...
I added some logging and found out that the ContextModule : IHttpModule is not even firing the Init... I attached my web.config file... I have the HttpModules section added... please help... thanks in advance! :)
correction i attached screenshots of my web.config file since it doesn't allow anything else...
0
Accepted
IT-Als
Top achievements
Rank 1
answered on 29 Feb 2012, 07:47 AM
Hi Scott,
What is your production environment? IIS7 Integrated mode?
If so, modules should be registered in the system.webServer section of the web.config like:
The system.web section is used for environments like IIS6 + II7 running classic mode.
I always add things in both places, so that it will run in all environments...
Let me know if it works out..
Regards
Henrik
What is your production environment? IIS7 Integrated mode?
If so, modules should be registered in the system.webServer section of the web.config like:
<configuration> <system.webServer> <modules> <add name="HelloWorldModule" type="HelloWorldModule"/> </modules> </system.webServer> </configuration>
The system.web section is used for environments like IIS6 + II7 running classic mode.
I always add things in both places, so that it will run in all environments...
Let me know if it works out..
Regards
Henrik
0
Scott
Top achievements
Rank 2
answered on 02 Mar 2012, 02:31 PM
That fixed it, thanks!