簡體   English   中英

Service Fabric 應用程序未注冊和運行 Actor

[英]Service Fabric Application doesn't register and run the Actor

我正在將帶有 Service Fabric 的 API 開發成一個大的解決方案。 在我創建了我需要的服務(一個 Actor,一個有狀態的和一個無狀態的 .NET 框架)之后,我做了一個 API 的骨架。 我開始測試,服務結構總是拋出錯誤“服務不存在”(我 100% 確定 uri 是正確的)何時調用 Actor(ActorProxyFactory 和 ActorProxy 都出現相同的錯誤)。 我在 Cluster Explorer 上查看,在我的 SF App 下只有另外兩個服務。 但是 ActorServiceType 已注冊。

所以我決定用一個演員創建兩個簡單的 SF 應用程序,但我遇到了同樣的錯誤,而且我在 Cluster Explorer 上也看不到它們。

在我沒有接觸過 ServiceManifest、ApplicationManifest 或其他任何項目的項目中。

這里是我使用的工具的版本:

  • Windows 11 企業
  • 帶有 .Net Framework 4.7.1 的 Visual Studio Enterprise v16.11.9
  • 服務結構運行時 8.1.321.9590
  • 服務面料 SDK 5.1.321.9590
  • Nuget Microsoft.SerivceFabric 8.1.321
  • Nuget Microsoft.ServiceFabric.Actors 5.1.321(對於 nuget 包,我嘗試了一切)
  • Microsoft.VisualStudio.Azure.Fabric.MSBuild 1.7.6(我也試過每個版本)

我自動生成的 setting.xml:

<?xml version="1.0" encoding="utf-8"?>
<Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Section Name="MyActorServiceReplicatorConfig">
    <Parameter Name="ReplicatorEndpoint" Value="MyActorServiceReplicatorEndpoint" />
    <Parameter Name="BatchAcknowledgementInterval" Value="0.005" />
  </Section>
  <Section Name="MyActorServiceReplicatorSecurityConfig">
    <Parameter Name="CredentialType" Value="None" />
  </Section>
  <!-- The content will be generated during build -->
</Settings>

我自動生成的服務清單.xml

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="MyActorPkg" Version="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <ServiceTypes>
    <StatefulServiceType ServiceTypeName="MyActorServiceType" HasPersistedState="true">
      <Extensions>
        <Extension Name="__GeneratedServiceType__" GeneratedId="5f4d2e71-68d5-43f4-b8a3-60990017b54d|Persisted">
          <GeneratedNames xmlns="http://schemas.microsoft.com/2015/03/fabact-no-schema">
            <DefaultService Name="MyActorService" />
            <ReplicatorEndpoint Name="MyActorServiceReplicatorEndpoint" />
            <ReplicatorConfigSection Name="MyActorServiceReplicatorConfig" />
            <ReplicatorSecurityConfigSection Name="MyActorServiceReplicatorSecurityConfig" />
            <StoreConfigSection Name="MyActorServiceLocalStoreConfig" />
            <ServiceEndpointV2_1 Name="MyActorServiceEndpointV2_1" />
          </GeneratedNames>
        </Extension>
      </Extensions>
    </StatefulServiceType>
  </ServiceTypes>
  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ExeHost>
        <Program>MyActor.exe</Program>
      </ExeHost>
    </EntryPoint>
  </CodePackage>
  <ConfigPackage Name="Config" Version="1.0.0" />
  <Resources>
    <Endpoints>
      <Endpoint Name="MyActorServiceEndpointV2_1" />
      <Endpoint Name="MyActorServiceReplicatorEndpoint" />
    </Endpoints>
  </Resources>
  <!-- The content will be generated during build -->
</ServiceManifest>

我自動生成的應用程序清單:

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="MyActorPkg" Version="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <ServiceTypes>
    <StatefulServiceType ServiceTypeName="MyActorServiceType" HasPersistedState="true">
      <Extensions>
        <Extension Name="__GeneratedServiceType__" GeneratedId="5f4d2e71-68d5-43f4-b8a3-60990017b54d|Persisted">
          <GeneratedNames xmlns="http://schemas.microsoft.com/2015/03/fabact-no-schema">
            <DefaultService Name="MyActorService" />
            <ReplicatorEndpoint Name="MyActorServiceReplicatorEndpoint" />
            <ReplicatorConfigSection Name="MyActorServiceReplicatorConfig" />
            <ReplicatorSecurityConfigSection Name="MyActorServiceReplicatorSecurityConfig" />
            <StoreConfigSection Name="MyActorServiceLocalStoreConfig" />
            <ServiceEndpointV2_1 Name="MyActorServiceEndpointV2_1" />
          </GeneratedNames>
        </Extension>
      </Extensions>
    </StatefulServiceType>
  </ServiceTypes>
  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ExeHost>
        <Program>MyActor.exe</Program>
      </ExeHost>
    </EntryPoint>
  </CodePackage>
  <ConfigPackage Name="Config" Version="1.0.0" />
  <Resources>
    <Endpoints>
      <Endpoint Name="MyActorServiceEndpointV2_1" />
      <Endpoint Name="MyActorServiceReplicatorEndpoint" />
    </Endpoints>
  </Resources>
  <!-- The content will be generated during build -->
</ServiceManifest>

我的 local1node.xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="fabric:/TEST2.MYACTOR.SF" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Parameters />
</Application>

屏幕集群資源管理器:

屏幕集群瀏覽器

屏幕集群資源管理器服務類型

在這個github 問題上找到了這個問題的解決方案,並提供了分步指南。
簡而言之,如果您安裝的不止是 Visual Studio(2019 和 2022),服務結構 package 緩存 go 有沖突。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM