WCF exec 在执行文件或程序集 System.ValueTuple 或其依赖项之一时

问题描述 投票:0回答:1

执行 WCF 时出现错误

 Exception through WCF, endpoint WCFEndpoint, while executing file or assembly System.ValueTuple or one of its dependencies
ERROR dial.Campaign.1.WCFEndpoint - [s13575s] [#188]: Exception through WCF, endpoint WCFEndpoint, while executing 'Dial(Tag=s13575s#client;To=5001;DetectionTypes=Nothing;DetectionTimeout=00:00:40;GreetingMsg=;SipHeaders(count)=0)':
System.TypeInitializationException: The type initializer for threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at Microsoft.Extensions.Logging.LoggerFactory.RefreshFilters(LoggerFilterOptions filterOptions)
   at Microsoft.Extensions.Logging.LoggerFactory..ctor(IEnumerable`1 providers)
   at DotNetty.Common.Internal.Logging.InternalLoggerFactory.NewDefaultFactory(String name)
   at DotNetty.Common.Internal.Logging.InternalLoggerFactory.get_DefaultFactory()
   at ‪‍‍‏‭‏‍‬‫‏‌‏‫​​‫‭‮‬‭‍‮..cctor()
   --- End of inner exception stack trace ---
Server stack trace: 
   at WcfExtensions.ExceptionMarshallingMessageInspector.System.ServiceModel.Dispatcher.IClientMessageInspector.AfterReceiveReply(Message& reply, Object correlationState)
   at System.ServiceModel.Dispatcher.ImmutableClientRuntime.AfterReceiveReply(ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at WCF.IFlexSipDialerContract.PlaceCall(String callTag, String groupTag, ILineAddress from, ILineAddress to, DetectionTypes detectionTypes, TimeSpan timeout, String greetingMsgName, Dictionary`2 sipHeaders)
   at FS.WCFEndpoint.<>c__DisplayClass11_0.<Dial>b__1(IFlexSipDialerContractEx service)
   at FS.WCFEndpoint._PerformUsingChannel[TRes](Func`2 method, String methodDescription)

我在配置中添加了这个 DLL,如下所示:

<dependentAssembly>
        <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
      </dependentAssembly>

但错误并没有消失。你还能做什么?

<dependentAssembly>
        <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
      </dependentAssembly>

添加这个。增加超时时间。

wcf dll
1个回答
0
投票

该异常表明您引用的程序集与程序期望的不一致。程序中可能存在程序无法确定的多个版本的引用。您可以尝试以下步骤来解决:

首先在运行时检查是否存在不同版本的旧引用,如果存在则删除。

然后删除引用并使用

Embed Interop Types = True
重新添加它们。

希望有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.