【问题标题】:Service Fabric Client on Azure App Service. Unable to load DLL 'FabricCommon.dll'Azure 应用服务上的 Service Fabric 客户端。无法加载 DLL 'FabricCommon.dll'
【发布时间】:2017-05-02 05:54:36
【问题描述】:

我在 Azure 上有 Service Fabric,并且 我有 Azure App Service(ASP.NET MVC 网站),它是 Service Fabric 微服务的客户端。

当我运行 Web 应用程序时,它显示:无法加载 DLL 'FabricCommon.dll':找不到指定的模块。 (HRESULT 异常:0x8007007E)

我见过Azure Service Fabric missing DLL on production server: FabricCommon.dll,但我不确定是否可以在 azure App Service 上安装 Service Fabric SDK

这是我的客户:

var factory = new CustomWcfCommunicationClientFactory<TContract>(
                CreateDefaultNetTcpBinding(),
                endpointBehaviors: new List<IEndpointBehavior> {new StarShipEnpointBehavior(up)},
                endpointIdentity: EndpointIdentity.CreateDnsIdentity("MyIdentity"),
                exceptionHandlers: new List<IExceptionHandler> {new WcfClientExceptionHandler()},
                servicePartitionResolver: ServicePartitionResolver.GetDefault());
var serviceFabricDescription = dict[typeof(TContract)];
return new WcfCommunicationClient<TContract>(
                factory,
                serviceFabricDescription.Uri,
                ServicePartitionKey.Singleton,
                listenerName: serviceFabricDescription.ListenerName);

其中“CustomWcfCommunicationClientFactory”与标准库“Microsoft.ServiceFabric.Services.Wcf”中的“WcfCommunicationClientFactory”几乎相同,但允许我提供行为和身份

这是堆栈跟踪:

[DllNotFoundException: Unable to load DLL 'FabricCommon.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)]
   System.Fabric.Interop.NativeCommon.FabricGetConfigStore(Guid& riid, IFabricConfigStoreUpdateHandler updateHandler) +0
   System.Fabric.Common.NativeConfigStore.CreateHelper(IFabricConfigStoreUpdateHandler updateHandler) +93
   System.Fabric.Interop.Utility.WrapNativeSyncInvoke(Func`1 func, String functionTag, String functionArgs) +29
   System.Fabric.Interop.Utility.RunInMTA(Func`1 func) +55
   System.Fabric.Common.Tracing.TraceConfig.InitializeFromConfigStore(Boolean forceUpdate) +133
   Microsoft.ServiceFabric.Services.ServiceTrace..cctor() +23

[TypeInitializationException: The type initializer for 'Microsoft.ServiceFabric.Services.ServiceTrace' threw an exception.]
   Microsoft.ServiceFabric.Services.Communication.Client.CommunicationClientCache`1..ctor(String traceId) +63
   Microsoft.ServiceFabric.Services.Communication.Client.CommunicationClientFactoryBase`1..ctor(IServicePartitionResolver servicePartitionResolver, IEnumerable`1 exceptionHandlers, String traceId) +283
   StarShip.Web.Logic.HelperService.CustomWcfCommunicationClientFactory`1..ctor(Binding clientBinding, IEnumerable`1 exceptionHandlers, IServicePartitionResolver servicePartitionResolver, String traceId, Object callback, ICollection`1 endpointBehaviors, EndpointIdentity endpointIdentity) +90
   StarShip.Web.Logic.HelperService.WcfHelper.GetClient(ICurrentUserProvider up) +504
   StarShip.Web.Logic.Services.<GetLocations>d__4.MoveNext() +98
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14139120
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   StarShip.Web.Logic.Services.<CreateLoginModel>d__3.MoveNext() +260
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14139120
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   StarShip.Web.Controllers.<Index>d__3.MoveNext() +215
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +14139120
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +93
   System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) +22
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +30
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +44
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157

【问题讨论】:

    标签: c# asp.net azure dll azure-service-fabric


    【解决方案1】:

    为了从集群外部与 SF 服务通信,您需要在服务内部公开一个通信端点,例如 WebApiWCFService Bus listener

    更多信息here

    编辑:

    您的代码 sn-p 使用不可用的 Service Fabric Sdk。因此,请依赖纯 WCF 代码来创建客户端代理。例如,从现有客户端复制它。或者公开一个元数据端点,如 this 并添加一个服务引用。

    【讨论】:

    • 我正在做的事
    【解决方案2】:

    好的,我的故事中棘手的部分是我不想将我的任何 Service Fabric 端点​​暴露给外界。相反,我想直接使用 VPN 将 Azure Web App 链接到 Service Fabric 群集。问题是我不能在没有安装 SDK 的情况下使用服务结构类。所以我现在使用 HTTP API。 https://github.com/lAnubisl/ServiceFabricHttpApiClient

    【讨论】:

      猜你喜欢
      • 2019-07-19
      • 2018-10-13
      • 1970-01-01
      • 2018-02-16
      • 2017-04-16
      • 2021-01-08
      • 2016-11-09
      • 2017-06-29
      • 2019-02-21
      相关资源
      最近更新 更多