【问题标题】:Azure Service Fabric missing DLL on production server: FabricCommon.dllAzure Service Fabric 在生产服务器上缺少 DLL:FabricCommon.dll
【发布时间】:2016-10-27 02:34:25
【问题描述】:

我创建了一个在开发集群上运行的参与者服务。一个 ASP.NET 应用程序(通过 IIS 单独托管)连接到集群并使用参与者。这很好用。

但是当我将所有内容部署到生产环境时,ASP.NET 应用程序无法连接到集群,但出现以下异常。集群托管在本地 (Windows 2012 R2)。

The type initializer for 'Microsoft.ServiceFabric.Services.ServiceTrace' threw an exception.

Stacktrace:
   at Microsoft.ServiceFabric.Services.Common.FabricServiceConfig.TryGetConfigPackageObject(String configPackageName, ConfigurationPackage& package)
   at Microsoft.ServiceFabric.Services.Common.FabricServiceConfig.GetSettingsFilePath(String configPackageName)
   at Microsoft.ServiceFabric.Services.Common.FabricServiceConfig.GetConfig()
   at Microsoft.ServiceFabric.Services.Common.FabricServiceConfigSection.Initialize()
   at Microsoft.ServiceFabric.Services.Communication.FabricTransport.Common.FabricTransportSettings.LoadFrom(String sectionName, String filepath, String configPackageName)
   at Microsoft.ServiceFabric.Services.Communication.FabricTransport.Common.FabricTransportSettings.TryLoadFrom(String sectionName, FabricTransportSettings& settings, String filepath, String configPackageName)
   at Microsoft.ServiceFabric.Services.Communication.FabricTransport.Common.FabricTransportSettings.GetDefault(String sectionName)
   at Microsoft.ServiceFabric.Actors.Remoting.FabricTransport.FabricTransportActorRemotingProviderAttribute.CreateServiceRemotingClientFactory(IServiceRemotingCallbackClient callbackClient)
   at Microsoft.ServiceFabric.Actors.Client.ActorProxyFactory.CreateServiceRemotingClientFactory(Type actorInterfaceType)
   at Microsoft.ServiceFabric.Actors.Client.ActorProxyFactory.GetOrCreateServiceRemotingClientFactory(Type actorInterfaceType)
   at Microsoft.ServiceFabric.Actors.Client.ActorProxyFactory.CreateActorProxy[TActorInterface](Uri serviceUri, ActorId actorId, String listenerName)
   at Microsoft.ServiceFabric.Actors.Client.ActorProxy.Create[TActorInterface](ActorId actorId, Uri serviceUri, String listenerName)

Inner Exception:
innerExceptionType: System.DllNotFoundException
innerStacktrace:
   at System.Fabric.Interop.NativeCommon.FabricGetConfigStore(Guid& riid, IFabricConfigStoreUpdateHandler updateHandler)
   at System.Fabric.Common.NativeConfigStore.CreateHelper(IFabricConfigStoreUpdateHandler updateHandler)
   at System.Fabric.Interop.Utility.WrapNativeSyncInvoke[TResult](Func`1 func, String functionTag, String functionArgs)
   at System.Fabric.Interop.Utility.RunInMTA[TResult](Func`1 func)
   at Microsoft.ServiceFabric.Common.Tracing.Trace.InitializeFromConfigStore()
   at Microsoft.ServiceFabric.Services.ServiceTrace..cctor()
innerExceptionMessage: Unable to load DLL 'FabricCommon.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
exceptionType: System.TypeInitializationException

似乎在 Web 服务器(托管 ASP.NET)上找不到 FabricCommon.dll

我发现这个文件是集群安装包的一部分。在开发机和集群机上,文件位于:C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code\FabricCommon.dll。但它显然不是通过 NuGet 在客户端应用程序中安装的依赖项。

我是否错过了在 Web 服务器上安装任何先决条件?我必须手动包含 DLL 吗?

【问题讨论】:

  • 当我尝试创建一个 ActorProxy 时,发生了所描述的错误。但与此同时(感谢这篇文章:stackoverflow.com/questions/38015934/…)我了解到,从集群外部的客户端应用程序中使用 ActorProxy 目前不能很好地工作。在同一个 SF 应用程序中使用无状态 WebAPI 服务是一种替代方法(如下所示:github.com/Azure-Samples/…)。

标签: azure-service-fabric


【解决方案1】:

将以下 Service Fabric bin 路径添加到 PATH 环境变量:

set PATH=%PATH%;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code 

还将执行策略设置为无限制:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser 

【讨论】:

    【解决方案2】:

    我认为您需要在 Web 服务器上安装 Service Fabric SDK。

    查看以下链接: https://azure.microsoft.com/en-us/documentation/articles/service-fabric-get-started/

    【讨论】:

    • 嗨。这解决了我的特殊问题(缺少 DLL)。但是,我必须将 Web 服务器转换为开发机器。连接到远程集群仍然是一个问题。与此同时,我找到了this
    【解决方案3】:

    我的开发机器上曾经发生过这种情况。我所做的只是重新安装 Service Fabric SDK。

    【讨论】:

      【解决方案4】:

      对于无法在目标环境中安装 Service Fabric SDK 的情况,可以选择使用 Service Fabric REST API

      这里是my repo,带有用 C# 编写的 API 客户端,可以使用此 API 解析服务

      【讨论】:

        【解决方案5】:

        我有同样的问题。重启我的机器解决了这个问题。

        【讨论】:

          猜你喜欢
          • 2018-07-21
          • 2017-06-09
          • 2020-01-23
          • 1970-01-01
          • 1970-01-01
          • 2018-01-06
          • 2018-05-30
          • 2019-05-31
          • 1970-01-01
          相关资源
          最近更新 更多