So let me start by saying that the weird thing about this error is that the application is running, and the error bubbles to the event log, but it's intermittent. Sometimes it's 2 hours between it happening, sometimes a few minutes, sometimes half an hour. Does not appear to be tied directly to requests (and requests don't seem to be failing because of it, though nearly all requests should be hitting NHibernate right now).
I've ensured that the dll is in the bin, it's unblocked (and if either of those weren't the case, I would expect it to fail always, not just sometimes).
For the app, I'm using Nhibernate 2.1.2, castle activerecord 2, ASP.NET MVC 2, and the app is deployed on IIS 7.5 with SQL Server 2005 for the db. I saw a similar error on Stack but no answers there, hoping someone has insight on this error.
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, BinaryAssem开发者_运维技巧blyInfo
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)
Does this also happen on Application start up or is it always at some time in the future after the application has started?
Check Unhandled IIS Exception - How can I track it down (which has a very similar stack trace) which leads to http://unhandledexception.codeplex.com/sourcecontrol/latest
I have gotten similar errors and found that the real problem is not being reported. The accepted answer here is specific to ASP.NET (which is fine since that is what the question was about), but I was having the issue with a WPF browser application (which doesn't have a web.config file) and I found another way to see what my real problem was. I thought I should post it in case other people will find it helpful.
If you are getting these while debugging in Visual Studio, it can help to go to Debug > Exceptions and select the "Thrown" checkboxes (I am using VS 2008). For me, this allowed the error to be reported in Visual Studio instead of my web browser, and provided more detailed and accurate error information.
If you do this, realize that some of these exceptions may have been previously handled but now will disrupt your workflow by breaking at those points. If this happens, you can just turn off the exceptions that you don't need to break on.
精彩评论