Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Invalid
-
None
-
None
-
.NET 3.5, Windows 2003 Server
Description
I'm running an iBatis query within a Timer's Elapsed handler and I'm getting the following exception:
IBatisNet.Common.Exceptions.IBatisNetException was unhandled by user code
Message="WebSessionStore: Could not obtain reference to HttpContext"
Source="IBatisNet.DataMapper"
StackTrace:
at IBatisNet.DataMapper.SessionStore.WebSessionStore.ObtainSessionContext()
at IBatisNet.DataMapper.SessionStore.WebSessionStore.get_LocalSession()
at IBatisNet.DataMapper.SqlMapper.QueryForList[T](String statementName, Object parameterObject)
:
:
at System.Timers.Timer.MyTimerCallback(Object state)
InnerException
After looking through the code, I found two places where this exception is thrown. Both look like:
private static HttpContext ObtainSessionContext()
{
HttpContext currentContext = HttpContext.Current;
if (currentContext == null)
{ throw new IBatisNetException("WebSessionStore: Could not obtain reference to HttpContext"); } return currentContext;
}