FileLoadException when try dispose Microsoft.Diagnostics.Tracing.Session.TraceEventSession from WindowsService

1

My WCF service is hosted in a windows service. Wanted the service class to be created as singletion, hence mentioned the servicebehavior attribute of the WCF service class accordingly. OnStart of the windows service host, I create an instance of this class and later use the same to create my service host. OnStop of the windows service, I call dispose on the service class as I need to ensure disposing of the Microsoft.Diagnostics.Tracing.Session.TraceEventSession, created during OnStart (at the WCF service side), when the service class instance was created. But I get exception when try dispose the session with message as below. My assemblies are all .net 4.6.1 version and cannot move to 4.7 now. THe System.Diagnostic.Tracing.TraceEvent dll is referred from Nuget for version 2.0.26 (On WCF Service and the BL dll, where actually the session object is maintained, which the WCF service refers). Then I have System.Runtime nuget installed again on WCF service and windows host with version 4.3.0.

Exception thrown: 'System.IO.FileLoadException' in Microsoft.Diagnostics.Tracing.TraceEvent.dll

Additional information: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).

Please let know if anymore info required to understand the problem.

c#
windows-services
.net-4.6.1
fileloadexception
asked on Stack Overflow Nov 23, 2018 by nishitha nair

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0