Deploy ASP.NET Core 5 app to Azure App Service?

后端 未结 1 1472
星月不相逢
星月不相逢 2021-01-04 18:58

I have an existing Azure App Service running on ASP.NET Core 3.x. I have upgraded the application to today\'s release of ASP.NET Core 5. This works fine on my local IIS Expr

相关标签:
1条回答
  • 2021-01-04 19:35

    It's not entirely clear from the release notes you referenced, but in order to take advantage of the new App Service Early Access feature (announcement), you need to explicitly configure your App Service to use the .NET 5 stack.

    Configuring an existing App Service for .NET 5

    To do this via the Azure Portal for an existing App Service, complete the following steps:

    1. Go to the App Service you want to upgrade
    2. Click on Configuration on the left-hand navigation
    3. Click on General Settings in the page-level navigation
    4. Under Stack Settings, select .NET
    5. Under Framework Version, select .NET 5

    Note: Technically, once you do this, you'll have the .NET 5 runtime installed and could switch back to e.g. the .NET Core runtime stack. Doing so, however, would prevent you from gaining early access to subsequent updates to .NET, so I wouldn't recommend it.

    Configuring a new App Service for .NET 5

    This opt-in for the App Service Early Access is far more explicit when configuring a new App Service via the Azure Portal. In that case, when creating an App Service, you'll be prompted to select the Runtime stack, under which .NET 5 is explicitly labeled as .NET 5 (Early Access).

    Note: If you already have another App Service configured to use App Service Early Access on the same App Service Plan, then the .NET 5 runtime will already be installed and available. This is because .NET runtimes are shared between App Services on the same App Service Plan.

    Visual Studio publishing warnings

    Even with the Early Access feature, you may still receive the following warning when publishing from Visual Studio 2019 16.8, assuming you have version compatibility checks enabled:

    Your application requires the .NET Core 5.0.0 runtime, but Microsoft Azure App Service only supports the following versions: 2.1.20, 2.1.22, 2.2.11, 2.2.14, 3.0.3, 3.1.6, and 3.1.8.

    Despite that, once you publish everything should work, even if you're using the Framework-dependent deployment mode.

    Limitations

    As a word of warning: The current implementation of the App Services Early Access feature doesn't yet support Application Insights integration. As such, if you're relying on the automatic integration from Azure, instead of custom instrumentation, you may want to wait until the App Service Early Access feature supports Application Insights integration.

    Note: I’ve created an issue requesting status updates regarding Application Insights compatibility, but haven’t yet heard back.

    Alternatives

    As an alternative, you can instead choose to deploy using the Self Contained deployment mode in your publishing profile (*.pubxml). This was the approach required for new releases of .NET Core on Azure App Services prior to .NET 5, and it continues to be supported today.

    0 讨论(0)
提交回复
热议问题