ServiceControl - instance seems to crash after starting

I’m attempting to set up ServicePulse for use with RabbitMQ. The ServiceControl instance appears to have been created successfully, but when ServicePulse tries to connect to the instance, it fails. I have noticed that the ServiceControl instance stops shortly after it is started. There is nothing in the log file that indicates an issue, but I am seeing an unhandled exception in the Application Event Log:

Application: ServiceControl.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.MissingMethodException
   at ServiceBus.Management.Infrastructure.OWIN.Startup+<>c__DisplayClass1_0.<Configuration>b__0(Owin.IAppBuilder)
   at Owin.MapExtensions.Map(Owin.IAppBuilder, Microsoft.Owin.PathString, System.Action`1<Owin.IAppBuilder>)
   at Owin.MapExtensions.Map(Owin.IAppBuilder, System.String, System.Action`1<Owin.IAppBuilder>)
   at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(Microsoft.Owin.Hosting.Engine.StartContext)
   at ServiceControl.Infrastructure.WebApi.WebApiHostedService.StartAsync(System.Threading.CancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host+<StartAsync>d__12.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions+<RunAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions+<RunAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Particular.ServiceControl.Commands.CommandRunner+<Execute>d__1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Particular.ServiceControl.Program+<Main>d__0.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Particular.ServiceControl.Program.<Main>(System.String[])

ServiceControl version 4.22.0
ServicePulse version 1.32.4
RabbitMQ version 3.8.11

Has anyone run into this issue?

Hi @jeff135,

I remember a support case a while back where the problem was very similar, and it was caused by an assembly registered in the machine’s global assembly cache (GAC). In that case, the assembly was Netwonsoft.Json. The assembly in the GAC had a different version than the one required by ServiceControl, and for some reason, was resolved by the .NET assembly resolver instead of the one indirectly referenced by ServiceControl through one of the OWIN packages.

Could you please check your GAC content and try to spot if something similar is happening?

If that is caused by a different assembly, then you need to go down the rabbit hole of using the assembly binding log viewer to try to detect which assembly is causing that failure.

Regards,
Mauro

Thank you for your response. I’m afraid I’m not sure exactly what I would be looking for in the GAC. Would you be able to elaborate?

Sorry, @jeff135. For some reason, I missed your response.

Let’s start with the primary attempt. On the machine where ServiceControl is failing to start with that MissingMethodException, look in GAC for Netwonsoft.Json assemblies. If you can find any, can you please report here which versions are the Netwonsoft.Json assemblies in the GAC?

.m

Here are the versions of the Newtonsoft.Json.dll files that I see in the GAC (in the GAC_MSIL folder):
12.0.3.23909
6.0.1.17001

Thanks for checking that for me.

Do you know why those assemblies are in the GAC? I don’t see a good reason for that. If they should not be there, you could remove them by running gacutil /u Newtonsoft.Json from an elevated command prompt.

That should allow ServiceControl to start successfully.