Utworzyłem usługę aktora, która działa w klastrze programistycznym. Aplikacja ASP.NET (hostowana osobno przez IIS), łączy się z klastrem i korzysta z aktorów. To działa dobrze.Usługa Azure Service Fabric brakuje biblioteki DLL na serwerze produkcyjnym: FabricCommon.dll
Ale kiedy wdrażam wszystko w środowisku produkcyjnym, aplikacja ASP.NET nie może połączyć się z klastrem z poniższym wyjątkiem. Klaster jest hostowany lokalnie (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
Wydaje się, że FabricCommon.dll nie można znaleźć na serwerze WWW (w którym odbywa się ASP.NET).
Znalazłem, że ten plik jest częścią pakietu instalacyjnego klastra. Na maszynie programującej i maszynach klastrowych plik znajduje się tutaj: C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code\FabricCommon.dll
. Ale najwyraźniej nie jest to zależność zainstalowana przez NuGet w aplikacji klienckiej.
Czy nie udało mi się zainstalować żadnych wymagań wstępnych na serwerze WWW? Czy muszę ręcznie dołączać bibliotekę DLL?
występuje Opisany błąd, gdy próbuję utworzyć ActorProxy. Ale w międzyczasie (dzięki temu wpisowi: http://stackoverflow.com/questions/38015934/how-to-create-actor-proxy-to-remote-service-fabric-cluster) dowiedziałem się, że używając ActorProxy z aplikacji klienckiej spoza klastra obecnie nie działa dobrze. Korzystanie z bezpaństwowej usługi WebAPI w ramach tej samej aplikacji SF jest alternatywą (jak pokazano tutaj: https://github.com/Azure-Samples/service-fabric-dotnet-web-reference-app). – Henrik