零星的“Fore_Session”从装配类型中的“get_session”没有实施“
-
13-11-2019 - |
题
突然,我开发的Web应用程序开始向用户提供此错误消息,但不适用于我,只有有时候。
我知道这个错误可能是由接口组装和实现组装参考版本不匹配引起的。但我没有长时间更新夏普的版本(仍然使用这个项目的旧版本)。此外,错误不会发生错误,如果它是错误的装配集,我想它会始终失败。
是什么原因?有框架中是否有任何跟踪/登录工具来查找?
Method 'get_Session' in type 'Orders.Data.SafeSessionStorage'
from assembly 'Orders.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
does not have an implementation."
System.TypeLoadException: Method 'get_Session' in type 'Orders.Data.SafeSessionStorage' from assembly 'Orders.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
at Orders.Web.MvcApplication.InitializeNHibernateSession()
at Orders.Web.MvcApplication.<Application_BeginRequest>b__1d()
at SharpArch.Data.NHibernate.NHibernateInitializer.InitializeNHibernateOnce(Action initMethod)
at Orders.Web.MvcApplication.Application_BeginRequest(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
.
这是SafesessionStorage。它是一个略微修改的sharkarch的版本,支持在背景线程中运行。
public class SafeSessionStorage : ISessionStorage
{
[ThreadStatic]
private static ISession _session;
public ISession Session
{
get
{
HttpContext context = HttpContext.Current;
if (context == null)
return _session;
else
{
ISession session = context.Items[factoryKey] as ISession;
return session;
}
}
set
{
HttpContext context = HttpContext.Current;
if (context == null)
_session = value;
else
context.Items[factoryKey] = value;
}
}
public string FactoryKey
{
get { return factoryKey; }
}
public static void End()
{
if (_session != null)
_session.Close();
_session = null;
}
public void EndRequest()
{
ISession session = Session;
if (session != null)
{
session.Close();
HttpContext context = HttpContext.Current;
if (context != null)
context.Items.Remove(factoryKey);
else
_session = null;
}
}
private string factoryKey = NHibernateSession.DefaultFactoryKey;
}
.
这是错误发生的地方:
private void InitializeNHibernateSession()
{
NHibernateInitHelper.InitSession(safeSessionStorage,
Server.MapPath("~/NHibernate.config"),
Server.MapPath("~/bin/Orders.Data.dll"));
}
.
这里Initsession需要issessionstorage并通过safesessionstorage,所以我想这是类型检查失败的地方。我会怀疑组装版本,但正如我所说,它总是对我有效,有时适用于用户。
解决方案
我会更好地接受Sehe的评论作为答案,但无论如何。由于递归数据库数据,问题是一个stackoverfloweption。调试此目录,我必须在疑似代码内的许多行添加日志记录(SOAP服务ECCCESS发生错误和使用DB映射数据),然后分析。另一种方法是部署调试构建(这是Dev Server)并使用WindBG,它给出了正确的异常代码0xE053534F,以便我可以专注于可能导致此的代码(递归LINQ方法收集相关产品)。 低驱动空间是DW20.exe(DR.WATSON)吃1.5 GB空间(和CPU)的副作用。
事件查看器是有点帮助,因为它显示了太过通用的“kernel32.dll,可以是堆栈溢出,并且可以是其他任何东西。
获取“方法没有实现”是我所期望的最后一个条件的最后信息。
不隶属于 StackOverflow