Particular / NServiceBus.Host.AzureCloudService

Azure Hosting for NServiceBus
https://docs.particular.net/nservicebus/hosting/cloud-services-host/
Other
0 stars 5 forks source link

Hosting.Azure.HostProcess crashes and will not run at all in DynamicHost without scannedAssemblies parameter #17

Closed CRuppert closed 9 years ago

CRuppert commented 9 years ago

Upgraded to latest as per product advisory this morning, was still in the 6.2 line prior to update.

First noticed when I could not debug. Throws as

Unhandled Exception: Magnum.StateMachine.StateMachineException: Exception occurred in Topshelf.Internal.ServiceController `1[[NServiceBus.Hosting.Azure.HostProcess.WindowsHost, NServiceBus.Hosting.Azure.HostProcess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c]] during state Initial while handling OnStart ---> Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type WindowsHost, key <some assembly>

you can resolve this by passing /scannedAssemblies=<EndpointAssemblyName> on the command line and everything executes fine.

However, there is no way to do this when running in the Azure DynamicHost. The thrown exception is slightly different when running via Azure DynamicHost, but the problem is the same.

This is a critical issue, as it prevents dynamic endpoints from hosting anything.

Full Stack trace as I've been able to capture is:

Unhandled Exception: Magnum.StateMachine.StateMachineException: Exception occurred in Topshelf.Internal.ServiceController`1[[NServiceBus.Hosting.Azure.HostProcess.WindowsHost, NServiceBus.Hosting.Azure.HostProcess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c]] during state Initial while handling OnStart ---> Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type WindowsHost, key "<assemblyName>.EndpointConfig, EventsInterface.Services.Points, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" ---> System.ArgumentException: String cannot have zero length.
   at System.Reflection.RuntimeAssembly.CreateAssemblyName(String assemblyString, Boolean forIntrospection, RuntimeAssembly& assemblyFromResolveEvent)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at NServiceBus.Hosting.Azure.GenericHost..ctor(IConfigureThisEndpoint specifier, String[] args, List`1 defaultProfiles, IEnumerable`1 scannableAssembliesFullName) in c:\BuildAgent\work\79b79bd92dd94994\src\NServiceBus.Hosting.Azure\GenericHost.cs:line 49
   at NServiceBus.Hosting.Azure.HostProcess.WindowsHost..ctor(Type endpointType, String[] args, IEnumerable`1 scannableAssembliesFullName) in c:\BuildAgent\work\79b79bd92dd94994\src\NServiceBus.Hosting.Azure.HostProcess\WindowsHost.cs:line 26
   at NServiceBus.Hosting.Azure.HostProcess.HostServiceLocator.DoGetInstance(Type serviceType, String key) in c:\BuildAgent\work\79b79bd92dd94994\src\NServiceBus.Hosting.Azure.HostProcess\HostServiceLocator.cs:line 31
   at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 49
   --- End of inner exception stack trace ---
SeanFeldman commented 9 years ago

@CRuppert are you referring to the critical bug regarding timeouts? The fix was in NServiceBus.Azure, not the host. Could you please let know all the packages and their exact versions you're using?

CRuppert commented 9 years ago

@SeanFeldman Yeah, the timeouts issue is what started the upgrades. I know it was just for the Azure package, but while I was at it, I upgraded the rest of the packages.

<package id="NServiceBus" version="5.2.8" targetFramework="net45" />
  <package id="NServiceBus.Azure" version="6.2.3" targetFramework="net45" />
  <package id="NServiceBus.Azure.Transports.WindowsAzureServiceBus" version="6.3.2" targetFramework="net45" />
  <package id="NServiceBus.CastleWindsor" version="5.0.0" targetFramework="net45" />
  <package id="NServiceBus.Hosting.Azure" version="6.2.4" targetFramework="net45" />
  <package id="NServiceBus.Hosting.Azure.HostProcess" version="6.2.4" targetFramework="net45" />
  <package id="NServiceBus.Log4Net" version="1.0.0" targetFramework="net45" />
  <package id="NServiceBus.Persistence.MongoDb" version="5.0.27.0" targetFramework="net45" />
  <package id="ServiceControl.Plugin.Nsb5.Heartbeat" version="1.1.0" targetFramework="net45" />
  <package id="WindowsAzure.ServiceBus" version="2.6.0" targetFramework="net45" />
  <package id="WindowsAzure.Storage" version="4.3.0" targetFramework="net45" />

I have it nailed down to what I described though. Execute the endpoint without the arg and it bombs because of an empty string error. Throw it in with the name of my endpoint's assembly and it fires right up.

SeanFeldman commented 9 years ago

I have quickly verified that host is working as before. @CRuppert could you please try this sample and see if it's working for you or provide a simple repro?

CRuppert commented 9 years ago

Sorry @SeanFeldman, our bad. Someone had some incorrect references. Unfortunately the error messaging for the host stuff did not indicate that as per usual. Apologies!

SeanFeldman commented 9 years ago

No worries at all @CRuppert