Service Fabric .Net Framework 4.5.1 和 4.6

Service Fabric .Net Framework 4.5.1 and 4.6

将目标框架从 4.5.1 更改为 4.6 后,Auzure 中的服务失败,本地部署正常。

我需要添加 .Net 4.6 支持吗? - 我找不到在哪里可以看到我的 Azure 集群中可用的框架。

谢谢

ApplicationName : fabric:/Lending20.Service.IdentityManagement AggregatedHealthState
: Error UnhealthyEvaluations : Unhealthy services: 100% (1/1), ServiceType='IdentityManagementServiceType', MaxPercentUnhealthyServices=0%.

Unhealthy service: ServiceName='fabric:/Lending20.Service.IdentityManagement/Identity ManagementService', AggregatedHealthState='Error'.

Unhealthy partitions: 100% (1/1), MaxPercentUnhealthyPartitionsPerService=0%.

Unhealthy partition: PartitionId='7c68b397-fda3-491d-9e17-921cd24217ca', AggregatedHealthState='Error'.

Error event: SourceId='System.FM', Property='State'.

ServiceHealthStates : ServiceName : fabric:/Lending20.Service.IdentityManagement/IdentityManagementService AggregatedHealthState : Error

DeployedApplicationHealthStates : ApplicationName : fabric:/Lending20.Service.IdentityManagement NodeName : _lending1 AggregatedHealthState : Ok

HealthEvents : SourceId : System.CM Property : State HealthState : Ok SequenceNumber : 3464 SentAt : 11/21/2015 12:38:08 PM ReceivedAt : 11/21/2015 12:38:08 PM TTL : Infinite Description : Application has been created. RemoveWhenExpired : False IsExpired : False Transitions : Warning->Ok = 11/21/2015 12:38:08 PM, LastError = 1/1/0001 12:00:00 AM

.NET 4.6 在 Azure 中使用的默认 Windows Server 2012 映像中尚不可用。此时,您唯一的选择是登录每个 VM 并安装它。

另一种选择是使用包含 DSC 扩展的 azure 资源组模板来配置您的 VM 以安装 .net 46。 这是我的 dsc powershell 中处理 .net 461 安装的片段 code or gist 以获得更完整的脚本

您可以使用以下ARM模板安装.NET 4.6.1。请注意,它依赖于此 script(由 Service Profiler 使用)。您也可以将其替换为任何其他 PowerShell 脚本。

参数为节点的基础名称。所以如果你的集群中有 VM0,.. VM5,你应该设置 vmName = 'VM'。 vmExtensionLoop设置为5个节点;你当然也可以改变它。

如果您使用 ARM 模板来部署您的集群,您可以将其作为其中的一部分。请注意,它可能会减慢规模集的部署速度,因为它需要重新启动。

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "vmName": {
      "type": "string",
      "metadata": {
        "description": "Virtual machine name."
      },
    }
  },
  "resources": [
    {
      "apiVersion": "2015-05-01-preview",
      "type": "Microsoft.Compute/virtualMachines/extensions",
      "name": "[concat(parameters('vmName'),copyIndex(0), '/CustomScriptExtensionInstallNet461')]",
      "location": "[variables('location')]",
      "tags": {
        "displayName": "CustomScriptExtensionInstallNet461"
      },
      "properties": {
        "publisher": "Microsoft.Compute",
        "type": "CustomScriptExtension",
        "typeHandlerVersion": "1.4",
        "autoUpgradeMinorVersion": true,
        "settings": {
          "fileUris": [ "https://gist.githubusercontent.com/aelij/7ea90dda4a187a482584/raw/a3e0f946d4a22b0af803edb503d0a30a263fba2c/InstallNetFx461.ps1" ],
          "commandToExecute": "powershell.exe -ExecutionPolicy Unrestricted -File InstallNetFx461.ps1"
        }
      },
      "copy": {
        "name": "vmExtensionLoop",
        "count": 5
      }
    }
  ]
}

在 Azure 原生支持 4.6 之前,我会使用预装 .NET 4.6 的自定义 VM 映像。有关如何创建和使用一个的详细信息,请参阅 this article

使用 windows Server 2016 映像获取 .net 4.6.1。预安装。 vmImageSku:配置集群时为“2016-Datacenter”。

现在 .NET 4.6 及更高版本可在 SDK 2.5.216 和运行时 5.5.216 版本中使用

详情请看:https://azure.microsoft.com/en-us/blog/announcing-azure-service-fabric-5-5-and-sdk-2-5/