ASP.NET 应用程序针对 NHibernate 抛出 "unable to find assembly"错误

标签 asp.net nhibernate debugging iis exception

首先我要说的是,这个错误的奇怪之处在于应用程序正在运行,并且错误会冒泡到事件日志中,但它是间歇性的。有时两次发生之间相隔两个小时,有时几分钟,有时半小时。似乎并不直接与请求相关(并且请求似乎并没有因此而失败,尽管几乎所有请求现在都应该命中 NHibernate)。

我已经确保 dll 在 bin 中,并且未被阻止(如果不是这种情况,我希望它总是失败,而不仅仅是有时)。

对于该应用程序,我使用 Nhibernate 2.1.2、caSTLe activerecord 2、ASP.NET MVC 2,该应用程序部署在 IIS 7.5 上,数据库使用 SQL Server 2005。我在 Stack 上看到了类似的错误,但没有答案,希望有人能深入了解这个错误。

Message: Unable to find assembly 'NHibernate, Version=2.1.2.4000, Culture=neutral,    
PublicKeyToken=aa95f207798dfdb4'.

StackTrace:    at    
System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at 
System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo 
assemblyInfo, String name)

at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, 
String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, 
Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo 
assemblyInfo, SizedArray assemIdToAssemblyTable)
at 
 System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)
at System.AppDomain.Deserialize(Byte[] blob)
at System.AppDomain.UnmarshalObject(Byte[] blob)

最佳答案

这种情况是否也会在应用程序启动时发生,还是总是在应用程序启动后的某个时间发生?

检查Unhandled IIS Exception - How can I track it down (它有一个非常相似的堆栈跟踪),这导致 http://unhandledexception.codeplex.com/sourcecontrol/latest

关于ASP.NET 应用程序针对 NHibernate 抛出 "unable to find assembly"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3652331/

相关文章:

windows - 在 windows 上使用 zlib 1.2.8 编译时出错

debugging - Linux内核实时调试是如何完成的,使用了哪些工具?

asp.net - 电子邮件验证链接的生成

c# - 为什么我的机器需要完全重置 IIS 才能看到 ASP.NET 项目的代码更改?

c# - 进行 SSL 连接时需要主机名验证

nhibernate - NHibernate 获取没有主键的子项

c# - 如何在 Fluent NHibernate 中映射 protected 集合?

.net - 作为System.Net.Mail附件的流为0字节

nhibernate - FluentNhibernate 和 NHibernate 3.2

debugging - 在远程 Glassfish 上进行日志记录和/或调试