use*_*094 2 azure azure-service-fabric
启动有状态服务时出现以下异常,这会阻止服务完全启动。如何解决此异常并启动服务?
System.InvalidCastException HResult=0x80004002 消息=无法将类型为“System.__ComObject”的 COM 对象转换为接口类型“IFabricNodeContextResult2”。此操作失败,因为 IID 为“{472BF2E1-D617-4B5C-A91D-FABED9FF3550}”的接口的 COM 组件上的 QueryInterface 调用因以下错误而失败:不支持此类接口(来自 HRESULT 的异常:0x80004002 (E_NOINTERFACE)) . 源 = mscorlib StackTrace:在 System.StubHelpers.InterfaceMarshaler.ConvertToManaged(IntPtr pUnk, IntPtr itfMT, IntPtr classMT, Int32 标志) 在 System.Fabric.Interop.NativeRuntime.FabricEndGetNodeContext(IFabricAsyncOperationContext context) 在 SystemtimeFabricFactory.FabricRun
这是我在此服务上的 nuget 包。
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.ServiceFabric" version="6.1.467" targetFramework="net461" />
<package id="Microsoft.ServiceFabric.Data" version="3.0.467" targetFramework="net461" />
<package id="Microsoft.ServiceFabric.Diagnostics.Internal" version="3.0.467" targetFramework="net461" />
<package id="Microsoft.ServiceFabric.FabricTransport.Internal" version="3.0.467" targetFramework="net461" />
<package id="Microsoft.ServiceFabric.Services" version="3.0.467" targetFramework="net461" />
<package id="Microsoft.ServiceFabric.Services.Remoting" version="3.0.467" targetFramework="net461" />
</packages>
Run Code Online (Sandbox Code Playgroud)
这是代码
namespace PrintFileStatefulService
{
/// <summary>
/// An instance of this class is created for each service replica by the Service Fabric runtime.
/// </summary>
internal sealed class PrintFileStatefulService : StatefulService, IPrintFileService
{
public PrintFileStatefulService(StatefulServiceContext context)
: base(context)
{ }
public Task GeneratePrintFile(Guid duesbillingId)
{
throw new NotImplementedException();
}
/// <summary>
/// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
/// </summary>
/// <remarks>
/// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
/// </remarks>
/// <returns>A collection of listeners.</returns>
protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
{
//return new ServiceReplicaListener[0];
return new[]
{
new ServiceReplicaListener(context => this.CreateServiceRemotingListener(context))
};
}
}
}
Run Code Online (Sandbox Code Playgroud)
我遇到了同样的问题,并找到了这个线程。原来本地服务结构 SDK 需要更新,一旦我这样做了它又开始工作了。
服务结构 SDK 的下载链接:http : //www.microsoft.com/web/handlers/webpi.ashx? command = getinstallerredirect&appid = MicrosoftAzure-ServiceFabric- CoreSDK
(或者,如果您不喜欢单击想要安装某些内容的链接,请转到此处并找到(相同)链接:https : //docs.microsoft.com/en-us/azure/service-fabric/service-fabric - 开始)
| 归档时间: |
|
| 查看次数: |
2105 次 |
| 最近记录: |