升级NServiceBus后“无法找到程序集”

时间:2012-08-14 20:24:20

标签: c# asp.net nservicebus

对于即将发布的版本,我们已从NServiceBus 3.0.3升级到3.2.7。我们在本地或QA测试期间没有遇到任何问题,但是在暂存环境中进行测试时,我们无法启动引用NServiceBus的IIS托管Web服务。

登台机使用与QA相同的软件; Windows 2008R2,IIS7.5

事件日志有两个错误。首先是事件1026(.NET运行时)

  

应用程序:w3wp.exe框架版本:v4.0.30319描述:   由于未处理的异常,进程被终止。例外信息:   NServiceBus.Unicast.Queuing.FailedToSendMessageException Stack:at   NServiceBus.Unicast.Queuing.Msmq.MsmqMessageSender.NServiceBus.Unicast.Queuing.ISendMessages.Send(NServiceBus.Unicast.Transport.TransportMessage,   NServiceBus.Address)at   NServiceBus.Unicast.UnicastBus.SendSubscribeMessageWithRetries(NServiceBus.Address,   NServiceBus.Unicast.Transport.TransportMessage,System.String,Int32)   在   NServiceBus.Unicast.UnicastBus + LT;> C_ DisplayClass8.b _7(System.Object的)   在System.Threading.ExecutionContext.runTryCode(System.Object)at   System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode,   CleanupCode,System.Object)at   System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,   System.Threading.ContextCallback,System.Object,Boolean)at   System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()   在System.Threading.ThreadPoolWorkQueue.Dispatch()at   System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

随后是事件1326(ASP.NET 4.0.30319.0)

  

发生了未处理的异常,并且该过程已终止。

     

应用程序ID:DefaultDomain

     

流程ID:10180

     

异常:System.Runtime.Serialization.SerializationException

     

消息:无法找到程序集'NServiceBus.Core,Version = 3.2.0.0,   Culture = neutral,PublicKeyToken = 9fc386479f8a226c'。

     

StackTrace:at   System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()   在   System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo   assemblyInfo,String name)at   System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(字符串   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   记录)   System.Runtime.Serialization.Formatters.Binary。 _BinaryParser.Run()
  在   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(流   serializationStream,HeaderHandler handler,Boolean fCheck,Boolean   isCrossAppDomain,IMethodCallMessage methodCallMessage)at   System.AppDomain.Deserialize(Byte [] blob)at   System.AppDomain.UnmarshalObject(Byte [] blob)

我检查了bin文件夹,它们包含正确版本的NServiceBus.dll和NServiceBus.Core.dll(两者都是相同的版本,3.2.7)。

我感到非常难过,认为我已经检查了明显的事情。是不是它正在尝试加载NServiceBus的几个版本(即一些未更新的引用?)。但是,这应该是QA中已经存在的问题了吗?

2 个答案:

答案 0 :(得分:2)

虽然是一个老问题,但我遇到了这个问题,我有一个解决方法

首先enable fusion logging。确保进程可以写入日志文件夹。

接下来,检查流程的位置。在我的情况下,它只搜索file:///c:/windows/system32/inetsrv/所以我在那里添加了dll NServiceBus.Core.DLL,现在我可以看到真正的问题。

我的猜测是在后台线程上发生了未处理的异常(第一个错误),然后将其序列化并传递给主线程,主线程尝试对其进行反序列化,但无法找到程序集(第二个错误)。第二个错误导致应用程序池死亡,这意味着我丢失了真正的错误。

此解决方法仅解决第二个错误,而不是原始问题。话虽如此,到目前为止,这已经足以让我再次使应用程序工作,并找到真正的错误,对我来说MSMQ是内存不足。所以我重新启动了MSMQ,它已经开始工作了。然后,我从新位置删除了NServiceBus.Core.DLL,该应用仍在运行。

记录输出:

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll

=== Pre-bind state information ===
LOG: User = IIS APPPOOL\TenBagsFull
LOG: DisplayName = NServiceBus.Core
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: NServiceBus.Core | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///c:/windows/system32/inetsrv/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = w3wp.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///c:/windows/system32/inetsrv/NServiceBus.Core.DLL.
LOG: Attempting download of new URL file:///c:/windows/system32/inetsrv/NServiceBus.Core/NServiceBus.Core.DLL.
LOG: Attempting download of new URL file:///c:/windows/system32/inetsrv/NServiceBus.Core.EXE.
LOG: Attempting download of new URL file:///c:/windows/system32/inetsrv/NServiceBus.Core/NServiceBus.Core.EXE.
LOG: All probing URLs attempted and failed.
Running under executable  c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows. 

答案 1 :(得分:2)

我们今天遇到了这个错误,我们的融合日志输出几乎与上面发布的Iain条目相同。我们的修复是清除MSMQ的事务死信消息队列并重新启动应用程序池。

  1. 转到“计算机管理”>服务和应用>消息队列>系统队列,并选择Transactional dead-letter消息。
  2. 右键单击,选择“所有任务”,然后选择“清除”。
  3. 重新启动您的应用池。