콘텐츠로 이동

Get started with the Azure App Service integration

이 콘텐츠는 아직 번역되지 않았습니다.

Azure App Service logo 🧪 Preview

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.

To begin, install the Aspire Azure App Service Hosting integration in your Aspire AppHost project:

Aspire CLI — Aspire.Hosting.Azure.AppService 패키지 추가
aspire add azure-appservice

Aspire CLI는 대화형입니다. 프롬프트 시 알맞은 검색 결과 선택:

Aspire CLI — 출력 예시
Select an integration to add:
> azure-appservice (Aspire.Hosting.Azure.AppService)
> Other results listed as selectable options...

Next, add an App Service environment to your AppHost project. The environment represents the hosting infrastructure (App Service Plan) where your apps will run:

C# — AppHost.cs
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 api to 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 F5 F5 F5 ), the project runs locally. When you publish your app, the project is deployed as an Azure App Service website within the provisioned environment.