azure - Unable to Install NServiceBus Host Windows Service -
azure - Unable to Install NServiceBus Host Windows Service -
i'm attempting follow instructions install windows service host using nservicebus.host.exe videostore sample app. i'm next instructions web site.
my application runs fine when doing f5 session in visual studio. it's hosting using console app mode host. when effort utilize command line perform installation, multiple errors.
the command line i'm running is:
nservicebus.host.exe /install /servicename:"videostore.sales" /displayname:"videostore.sales" /description:"endpoint videostore.sales" /endpointconfigurationtype:"videostore.sales.endpointconfig, videostore.sales" /username:".\mysvc" /password:"mypassword" nservicebus.production
running resulted in next exception:
initializing installer in install appdomain
unhandled exception: system.invalidoperationexception: sequence contains more 1 matching element @ system.linq.enumerable.singleordefault[tsource](ienumerable1 source, func
2 predicate) @ system.linq.enumerable.whereselectarrayiterator2.movenext() @ system.linq.enumerable.whereenumerableiterator
1.movenext() @ system.collections.generic.list1..ctor(ienumerable
1 collection) @ system.linq.enumerable.tolist[tsource](ienumerable1 source) @ nservicebus.hosting.profiles.profilemanager..ctor(list
1 assembliestoscan, iconfigurethisendpoint specifier, string[] args, list`1 defaultprofiles)
it turns out, error caused because application referencing both nservicebus.host assembly nservicebus.hosting.azure assembly. because application beingness deployed both in windows environment azure worker role. can switch between azure emulator , console-mode worker roles without issue changing projects i'm starting when debugging. (azure cloud service project vs each of worker projects.)
i able resolve deleting nservicebus.hosting.azure.dll assembly prevent assembly scanning finding it. imho, bug. either allow me specify host type explicitly or handle scenario multiple types found.
this stopped previous exception, , instead introduced new one:
unhandled exception: system.configuration.configurationerrorsexception: command line argument 'endpointconfigurationtype' has specified utilize type 'videostore.sales.endpointconfig, videostore.sales' type not loaded. @ nservicebus.hosting.windows.endpointtypedeterminer.trygetendpointconfigurationtypefromarguments(hostarguments arguments, type& type) in y:\buildagent\work \31f8c64a6e8a2d7c\src\nservicebus.hosting.windows\endpointtypedeterminer.cs:line 101 @ nservicebus.hosting.windows.program.main(string[] args) in y:\buildagent\work\31f8c64a6e8a2d7c\src\nservicebus.hosting.windows\program.cs:line 38
both type , assembly exist. i've verified .net loading type via enabling fusion loader logging:
the operation successful. bind result: hr = 0x0. operation completed successfully.
assembly manager loaded from: c:\windows\microsoft.net\framework64\v4.0.30319\clr.dll running under executable c:\projects\testing\nservicebus.azure.samples-master\videostore.azureservicebus.cloud\videostore.sales\bin\debug\nservicebus.host.exe --- detailed error log follows.
=== pre-bind state info === log: displayname = videostore.sales (partial) wrn: partial binding info supplied assembly: wrn: assembly name: videostore.sales | domain id: 1 wrn: partial bind occurs when part of assembly display name provided. wrn: might result in binder loading wrong assembly. wrn: recommended provide specified textual identity assembly, wrn: consists of simple name, version, culture, , public key token. wrn: see whitepaper http://go.microsoft.com/fwlink/?linkid=109270 more info , mutual solutions issue. log: appbase = file:///c:/projects/testing/nservicebus.azure.samples-master/videostore.azureservicebus.cloud/videostore.sales/bin/debug/ log: initial privatepath = null log: dynamic base of operations = null log: cache base of operations = null log: appname = nservicebus.host.exe calling assembly : nservicebus.host, version=4.6.0.0, culture=neutral, publickeytoken=9fc386479f8a226c.
what doing wrong here?
edit
i believe see issue. basically, trying avoid first error nservicebus resolving multiple profiles due fact it's finding them in both nservicebus.core , nservicebus.hosting.azure causing sec error.
this because in order load endpointconfig type, .net needs load nservicebus.hosting.azure assembly, implements asa_worker, lives in nservicebus.hosting.azure.
so deleting assembly, i'm preventing loading endpointconfig.
i'm still unclear how resolve this. need nservicebus stop scanning both hosting assemblies. suggests christof13's reply correct, i'm unable nservicebus ignore own assemblies.
the root cause of issue when nservicebus enumerates profiles available, scans available assemblies , linq statement filter them downwards type name.
the problem there 2 nservicebus.production profiles, 1 defined in nservicebus.host.dll, , 1 in nservicebus.hosting.azure assembly. type names identical, , linq singleordefault fails.
the suggestion filter assemblies searched wouldn't work because nservicebus loads own assemblies. filter applies project's assemblies.
i able resolve creating custom profile doesn't have same name other profile defined in assemblies in project. like:
public class dualcloudlocalprofile : iprofile {} public class dualcloudlocalprofilehandler : ihandleprofile<dualcloudlocalprofile> { public void profileactivated() { if (logmanager.loggerfactory nullloggerfactory || logmanager.loggerfactory == null) { configure.instance.tracelogger().consolelogger(); } } } public class cloudprofilelogginghandler : iconfigureloggingforprofile<dualcloudlocalprofile> { public void configure(iconfigurethisendpoint specifier) { //nothing } }
once added project, modified install command specify new profile:
nservicebus.host.exe /install /servicename:"videostore.sales" /displayname:"videostore.sales" /description:"endpoint videostore.sales" /endpointconfigurationtype:"videostore.sales.endpointconfig, videostore.sales" /username:".\mysvc" /password:"mypassword" videostore.sales.dualcloudlocalprofile
this resolved problem. can run project cloud service , nservicebus.host.exe hosted service, deploy via /install command host.
azure nservicebus
Comments
Post a Comment