Publishing to Azure
Publishing your new project to Azure could not be simpler:
- Create a new MS SQL database in Azure.
- Ensure that the
appsettings.Production.jsonfile has the appropriate production values, including the database connection string. Ensure that the connection string has
MultipleActiveResultSets=True, otherwise some operations will not work.
- Open the Package Manager Console and type
$env:ASPNETCORE_ENVIRONMENT = 'Production'. Then run
update-database. This will create your tables in your production database. When you are done,
$env:ASPNETCORE_ENVIRONMENT = 'Development', to set your environment back to Development. Be very careful with this in the future, because you could be inadvertently be running against he production database.
- Right click on the project in the solution explorer and select
Azureas the target and click next.
Azure App Service (Windows)as the target and click Next.
- If you do not already have an Azure resource group created, visit the Azure Portal to create one.
- Select the resource group and click on
Create a new Azure App Service.... Fill out the information about the new service and click Create.
- Once created, the dialog will close and then you click on Finish.
- Then click Publish. Once the publish process is complete, your browser will open with the new page. If everything there looks good and you are able to log in as the admin user, you are good to go!
Table of Contents
- Initial Setup
- Project Structure
- Entity Framework
- User Interface
- Email Service
- Background Workers
- Creating a new Page
- Publishing to Azure