While trying to deploy an ASP.NET Core MVC application in Azure, I'm getting this error
Error: Process completed with exit code 1
Please see the screenshot for more details:
Actual task is to deploy ASP.NET Core MVC application in Azure.
Application framework is .NET 8 and while creating a web app in App Service selected .NET 8 framework version. Next connected it with github repository by choosing the CI enabled option in App Service.
Once clicked 'create' button, application started to build and deploy process. After sometime it throws an error, log is attached already.
Here is the progress error:
I need help to deploy application in Azure.
I got the same issue when I followed your process of creating an Azure web app and connecting it to the GitHub repository by selecting the CI-enabled option.
The dotnet publish
command is failing because of the output directory path is not valid.
So, I changed the dotnet publish and upload-artifact path in GitHub yml file as shown below.
- name: dotnet publish
run: dotnet publish -c Release -o ./myapp
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: .net-app
path: ./myapp
Below is my complete workflow file.
GitHub/Workflow file:
name: Build and deploy ASP.Net Core app to Azure Web App - kaaspmvcapp
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Build with dotnet
run: dotnet build --configuration Release
- name: dotnet publish
run: dotnet publish -c Release -o ./myapp
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: .net-app
path: ./myapp
deploy:
runs-on: windows-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: .net-app
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_<ClientId-key>}}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_<TenantId-key> }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_<SUBSCRIPTIONID-key> }}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'kaaspmvcapp'
slot-name: 'Production'
package: .
After changing workflow file it is successfully deployed to Azure App service.
Azure App Service Output: