【问题标题】:Configuring service fabric as API management backend将服务结构配置为 API 管理后端
【发布时间】:2018-08-01 16:25:36
【问题描述】:

我开始探索将 API 管理服务与服务结构后端集成,但我无法让它工作。

我有一个简单的应用程序部署到一个公开一个无状态服务的集群。我正在尝试使用我能找到的几个示例来配置 API 管理,例如:

https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-api-management-overview

但我收到一条错误消息,告诉我无法找到给定的后端 ID,无论我输入什么。

我已阅读对此问题的回复,其中指出我需要设置后端资源: API Management vs. Service Flow

...链接到本教程中的模板: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-deploy-api-management

并尝试提取“后端”部分,但仍无法使其正常工作。有没有人有一个简单的示例或说明说明如何设置后端资源,以便我可以设置指向集群中运行的服务结构服务的 set-backend-service 入站规则?

谢谢

【问题讨论】:

    标签: azure azure-service-fabric azure-api-management


    【解决方案1】:

    我知道这有点老了,我解决了如下:

    $apimContext = New-AzureRmApiManagementContext -ResourceGroupName "resourcegroupname" -ServiceName "ApiManagementServicename"
    $ManagementEndpoints = 'https://xxxxx:19000'
    $ServerCertificateThumbprints = 'thumbprint'
    $serviceFabric = New-AzureRmApiManagementBackendServiceFabric -ManagementEndpoint $ManagementEndpoints -ClientCertificateThumbprint $ServerCertificateThumbprints -ServerCertificateThumbprint $ServerCertificateThumbprints
    $backend = New-AzureRmApiManagementBackend -Context $apimContext -BackendId SFBackEnd -Url 'fabric:/App/Service' -Protocol http -ServiceFabricCluster $serviceFabric -Description "service fabric backend"
    

    然后转到 Api 并在入站标签下放置以下内容:

    <set-backend-service backend-id="SFBackEnd" sf-service-instance-name="fabric:/App/Service" />
    

    确保命令“New-AzureRmApiManagementBackend”中的 url 与“sf-service-instance-name”相同

    干杯

    【讨论】:

      【解决方案2】:

      似乎通过 ARM 模板创建后端是使其工作的最佳方式,但请尝试使用专门用于在 API 管理中创建 SF 后端的命令:new-AzureRmApiManagementBackendServiceFabric

      https://docs.microsoft.com/en-us/powershell/module/azurerm.apimanagement/new-azurermapimanagementbackendservicefabric

      我做到了,但遇到了另一个阻止程序:UI 拒绝接受在命令中创建的 BackendID。它说 ID 无效,即使考虑到命令 get-AzureRmApiManagementBackend 显示最近创建的 ID。

      【讨论】:

      • 嗨,我也通过 .Net SDK 在 API Management 中创建了 SF BackEnd,我可以在资源管理器中看到它。但是,我不知道如何将该后端绑定到 API 管理服务中的 API。有什么帮助吗?
      【解决方案3】:

      输入https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/backends/sfbackend?api-version=2017-03-01

      {
        "properties": {
          "description": "Service Fabric Test App 1",
          "protocol": "http",
          "url": "fabric:/mytestapp/mytestservice",
          "properties": {
            "serviceFabricCluster": {
              "managementEndpoints": [
                "https://somecluster.com"
              ],
              "clientCertificatethumbprint": "EBA029198AA3E76EF0D70482626E5BCF148594A6",
              "serverX509Names": [
                {
                  "name": "ServerCommonName1",
                  "issuerCertificateThumbprint": "IssuerCertificateThumbprint1"
                }
              ],
              "maxPartitionResolutionRetries": 5
            }
          }
        }
      }
      

      来自https://docs.microsoft.com/en-us/rest/api/apimanagement/backend/createorupdate#apimanagementcreatebackendservicefabric

      【讨论】:

        猜你喜欢
        • 2019-03-01
        • 2018-12-21
        • 1970-01-01
        • 2017-12-25
        • 1970-01-01
        • 1970-01-01
        • 2020-04-26
        • 1970-01-01
        • 2019-03-16
        相关资源
        最近更新 更多