Get started with the Azure App Service integration
Este conteúdo não está disponível em sua língua ainda.
Azure App Service is a fully managed platform for building, deploying, and scaling web apps. Aspire apps often run locally during development but require scalable, production-ready hosting environments for staging and production. The Aspire integration allows you to provision or reference an existing Azure App Service environment (App Service Plan) and seamlessly publish your container, executable, and project resources as Azure App Service websites.
In this introduction, you’ll see how to install and use the Aspire Azure App Service integration in a simple configuration. If you already have this knowledge, see Azure App Service Hosting integration for full reference details.
Set up hosting integration
Section titled “Set up hosting integration”To begin, install the Aspire Azure App Service Hosting integration in your Aspire AppHost project:
aspire add azure-appserviceA Aspire CLI é interativa; escolha o resultado adequado quando solicitado:
Select an integration to add:
> azure-appservice (Aspire.Hosting.Azure.AppService)> Other results listed as selectable options...#:package Aspire.Hosting.Azure.AppService@*<PackageReference Include="Aspire.Hosting.Azure.AppService" Version="*" />Next, add an App Service environment to your AppHost project. The environment represents the hosting infrastructure (App Service Plan) where your apps will run:
var builder = DistributedApplication.CreateBuilder(args);
var appServiceEnv = builder.AddAzureAppServiceEnvironment("app-service-env");
builder.AddProject<Projects.WebApi>("api") .PublishAsAzureAppServiceWebsite((infra, website) => { // Optional: customize the Azure App Service website here });
builder.Build().Run();The preceding code:
- Creates an Azure App Service environment named
app-service-env. - Adds a project named
apito the AppHost. - Configures the project to be published as an Azure App Service website.
- Provides an optional callback to customize the website configuration.
During local development (when running with