服务结构应用程序部署

时间:2019-11-05 01:06:14

标签: c# azure azure-service-fabric service-fabric-stateful service-fabric-stateless

注册服务结构应用程序失败,并显示错误

”在商店中未找到应用程序包'ServiceFabricApp'。请确保先前已将该软件包复制到商店。如果先前已成功预配了该软件包,则可能基于清理政策。”

更多上下文,我正在使用服务结构API来连接,创建/升级应用程序。 遵循此文档:https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-deploy-remove-applications-fabricclient#code-example

能够将应用程序软件包复制到本地路径中,并添加一些“ C:\ ImageFolder”(能够验证该软件包是否存在,并且对该文件夹具有只读权限)。我在 ProvisionApplicationAsync 上遇到问题。

    try
    {
        fabricClient.ApplicationManager.ProvisionApplicationAsync(packagePathInImageStore).Wait();

        Console.WriteLine("Provisioned application type {0}", packagePathInImageStore);
    }
    catch (AggregateException ae)
    {
        Console.WriteLine("Provision Application Type failed:");

        foreach (Exception ex in ae.InnerExceptions)
        {
            Console.WriteLine("HResult: {0} Message: {1}", ex.HResult, ex.Message);
        }
    }

有错误:

在商店中找不到应用程序包'ServiceFabricApp'。确保之前已将软件包复制到商店。如果以前成功配置了该程序包,则可能已根据清理策略删除了该临时程序包。

CopyApplication代码:

   string imageStoreConnectionString = "file:C:\ImageFolder";
   string packagePathInImageStore = "ServiceFabricApp";
   try
    {
        fabricClient.ApplicationManager.CopyApplicationPackage(imageStoreConnectionString, packagePath, packagePathInImageStore);
        Console.WriteLine("Application package copied to {0}", packagePathInImageStore);
    }
    catch (AggregateException ae)
    {
        Console.WriteLine("Application package copy to Image Store failed: ");
        foreach (Exception ex in ae.InnerExceptions)
        {
            Console.WriteLine("HResult: {0} Message: {1}", ex.HResult, ex.Message);
        }
    }

1 个答案:

答案 0 :(得分:0)

必须将图像存储更改为:fabric:ImageStore

此处有更多详细信息:https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-image-store-connection-string