Could not load type System.Runtime.Diagnostics.ITraceSourceStringProvider
Asked Answered
P

1

10

I just did an in-place upgrade of Windows Server 2008 R2 to Windows Server 2012 and now my WCF Self-Hosted service starts but terminates immediately with the following error:

Service cannot be started. System.TypeLoadException: Could not load type 'System.Runtime.Diagnostics.ITraceSourceStringProvider' from assembly 'System.ServiceModel.Internals, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. at System.ServiceModel.Channels.TextMessageEncoderFactory..ctor(MessageVersion version, Encoding writeEncoding, Int32 maxReadPoolSize, Int32 maxWritePoolSize, XmlDictionaryReaderQuotas quotas) at System.ServiceModel.Channels.HttpTransportDefaults.GetDefaultMessageEncoderFactory() at System.ServiceModel.Channels.HttpChannelListener..ctor(HttpTransportBindingElement bindingElement, BindingContext context) at System.ServiceModel.Channels.HttpChannelListener`1..ctor(HttpTransportBindingElement bindingElement, BindingContext context) at System.ServiceModel.Channels.HttpTransportBindingElement.BuildChannelListener[TChannel](BindingContext context) at System.ServiceModel.Channels.BindingContext.BuildInnerChannelListenerTChannel at System.ServiceModel.Channels.MessageEnc...

The same service runs fine on a fresh install of Windows Server 2012 (although not fully patched atm).

Pharmacopsychosis answered 18/6, 2014 at 17:35 Comment(3)
I would try reinstalling .net 4 \ 4.5 . any chance your service is compiled aginst a mix of .net 4.0 and 4.5?Saveall
It has quite a few nuget packages that have been compiled against .net 4.0. The service itself is targeted at 4.5.1.Pharmacopsychosis
you should have a configuration somwhere stating which DLLs exactly you need, and if you don't there's a way to specificly request to get the 4.5.1 version... something dll manifest IIRCSaveall
P
8

A re-install of .NET 4.5.2 as suggested by AK_ fixed the problem.

Pharmacopsychosis answered 18/6, 2014 at 18:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.