[英]Configuring service fabric as API management backend
我開始探索將API管理服務與服務結構后端集成在一起的方法,但是我無法使其正常工作。
我有一個部署到群集的簡單應用程序,該群集公開了一項無狀態服務。 我正在嘗試使用一些我可以找到的示例來配置API管理,例如:
https://docs.microsoft.com/zh-cn/azure/service-fabric/service-fabric-api-management-overview
但是我收到一條錯誤消息,告訴我無論輸入什么,都找不到給定的后端ID。
我已閱讀對這個問題的回答,其中指出我需要設置一個后端資源: API管理與服務流
...它鏈接到本教程中的模板: https : //docs.microsoft.com/zh-cn/azure/service-fabric/service-fabric-tutorial-deploy-api-management
並嘗試提取“后端”部分,但仍無法使其正常工作。 有沒有人有一個簡單的示例或說明,說明如何設置后端資源,以便我可以設置指向后端在群集中運行的服務結構服務的set-backend-service入站規則?
謝謝
{
"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
}
}
}
}
似乎通過ARM模板創建后端是使其工作的最佳方法,但是請嘗試使用專門在API Management中創建SF后端的命令:new-AzureRmApiManagementBackendServiceFabric
我確實做了,但是遇到了另一個障礙:UI拒絕接受在命令中創建的BackendID。 它說,即使考慮到命令get-AzureRmApiManagementBackend顯示了最近創建的ID,該ID也是無效的。
我知道這有點陳舊,我將其解決如下:
$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和inbound標簽:
<set-backend-service backend-id="SFBackEnd" sf-service-instance-name="fabric:/App/Service" />
確保命令“ New-AzureRmApiManagementBackend”中的網址與“ sf-service-instance-name”相同
干杯
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.