我刚刚将Windows Server 2008 R2就地升级到Windows Server 2012,现在我的WCF自托管服务启动但立即终止并出现以下错误:
无法启动服务。 System.TypeLoadException:无法加载 type' System.Runtime.Diagnostics.ITraceSourceStringProvider'从 assembly' System.ServiceModel.Internals,Version = 4.0.0.0, Culture = neutral,PublicKeyToken = 31bf3856ad364e35'。在 System.ServiceModel.Channels.TextMessageEncoderFactory..ctor(MessageVersion 版本,编码writeEncoding,Int32 maxReadPoolSize,Int32 maxWritePoolSize,XmlDictionaryReaderQuotas配额) System.ServiceModel.Channels.HttpTransportDefaults.GetDefaultMessageEncoderFactory() 在 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 上下文) System.ServiceModel.Channels.BindingContext.BuildInnerChannelListenerTChannel 在System.ServiceModel.Channels.MessageEnc ...
同样的服务在全新安装的Windows Server 2012上运行良好(虽然没有完全修补atm)。
答案 0 :(得分:7)
按照AK_的建议重新安装.NET 4.5.2解决了这个问题。