这是因为您在Service Fabric运行时环境之外运行服务EXE.当您将服务编译为EXE时,您不能单独执行它; 您必须"部署"Service Fabric集群,Service Fabric运行时环境将为您执行该集群.
如果要通过Visual Studio进行部署,请确保将应用程序项目设置为启动项目,而不是服务项目(启动项目将在解决方案资源管理器中以粗体显示).
此外,与您看到的错误无关但只是抬头:当您升级到最新的2.0.135 SDK时,您需要更新服务注册码以使用新的ServiceRuntime:
try { ServiceRuntime.RegisterServiceAsync("RunSetManagerServiceType", context => new RunSetManagerService(context)).GetAwaiter().GetResult(); ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(Stateless1).Name); // Prevents this host process from terminating so services keep running. Thread.Sleep(Timeout.Infinite); } catch (Exception e) { ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString()); throw; }