page_type | urlFragment | languages | products | description | ||||
---|---|---|---|---|---|---|---|---|
sample |
5-deploy-web-api |
|
|
Deploying a protected ASP.NET Core web API and calls the API from Desktop application |
In this guide, we will deploy our project component, TodoListService to Azure App Services.
- Visual Studio 2019 or the .NET Core SDK and VS Code.
- An Azure subscription. This sample uses Azure App Services.
- We recommend Azure Tools for VS Code Extension for interacting with Azure services directly within VS Code.
We will deploy our web API on Azure App Services.
There are two ways to publish the app:
- Publish using Visual Studio
- Publish using Visual Studio Code
Follow the instructions at Publish a Web app to Azure App Service using Visual Studio.
Using a command line interface such as VS Code integrated terminal, follow the documentation Publish an ASP.NET Core app to Azure with Visual Studio Code.
On the App Services portal, click on the Configuration blade and set the stack property to .NET Core.
Still on the App Services portal, click on the Authentication/Authorization blade. There, make sure that the App Services Authentication is switched off (and nothing else is checked), as we are using our own authentication logic.
- Open the
TodoListClient\app.config
file - Find the key
todo:TodoListBaseAddress
and replace the existing value with the Resource Uri that you've just obtained in deploying TodoListService on App Service (e.g. https://my-web-api.azurewebsites.net/). - Re-build and run your client application.
Here we discuss some of the more important aspects of deploying multi-tenant application suites.
- In case you receive the
HTTP Error 500.30 - ANCM In-Process Start Failure
error for your Web API on Azure App Services, try adding this line toTodoListService/TodoListService.csproj
and re-deploy your project:
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UserSecretsId>aspnet-TodoListService-BA938C29-8BAB-4664-A688-8FD54049C1C3</UserSecretsId>
<WebProject_DirectoryAccessLevelKey>1</WebProject_DirectoryAccessLevelKey>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel> // Add this line
</PropertyGroup>
[!NOTE] Did the sample not work for you as expected? Did you encounter issues trying this sample? Then please reach out to us using the GitHub Issues page.
- Quickstart: Create an ASP.NET Core web app in Azure
- [Tutorial: Authenticate and authorize users end-to-end in Azure App Service](https://docs.microsoft.com/azure/app-service/app-service-web-tutorial-auth-Microsoft Entra ID)
- Authentication and authorization in Azure App Service and Azure Functions
- [Configure your App Service or Azure Functions app to use Microsoft Entra login](https://docs.microsoft.com/azure/app-service/configure-authentication-provider-Microsoft Entra ID)
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.