启动状态服务时无法加载文件或程序集'System.ServiceModel,Version = 4.0.0.0'异常

Rag*_*lly 3 c# .net-core azure-service-fabric

我已在Visual Studio 2017(版本15.7.1)中创建了一个新的Service Fabric应用程序,并使用.Net Core 2.0状态服务模板添加了新服务。

当我尝试运行该服务时,它无法正确启动,并且在“诊断事件”中可以看到以下异常:

Description ='Replica在_Node_0上打开期间发生了多次失败。API调用:IStatefulServiceReplica.ChangeRole(P);

错误= System.IO.FileNotFoundException(-2147024894)无法加载文件或程序集'System.ServiceModel,版本= 4.0.0.0,区域性=中性,PublicKeyToken = b77a5c561934e089'。该系统找不到指定的文件。

Rag*_*lly 8

我通过安装Nuget软件包修复了此问题 System.ServiceModel.Primitives

PM> Install-Package System.ServiceModel.Primitives
Run Code Online (Sandbox Code Playgroud)