Problem definition
I am developing ASP.NET MVC 7 application. I want to enable CI/CD, however this is my first use of Azure services. I tried to create App Service through Azure portal and enable Github actions (standard .yaml workflow that is automatically set by Azure). Everything succeeded.
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy ASP.Net Core app to Azure Web App - YouInvestMe
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.x'
include-prerelease: true
- name: Build with dotnet
run: dotnet build --configuration Release
- name: dotnet publish
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: .net-app
path: ${{env.DOTNET_ROOT}}/myapp
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: .net-app
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'YouInvestMe'
slot-name: 'Production'
publish-profile: ${{ secrets.PUBLISH_PROFILE }}
package: .
However, when to access the website via ***.azurewebsites.net, it says the webapp is running and waiting for my content.
I have tried to check over all files that are in /home/site/wwwroot/
and mostly they are .dll files. Accessing the terminal with Web SSH, I even tried running the main .dll with dotnet
command, and it worked but on localhost:5000, so I couldn't see.
Q: How can I configure/deploy my project so that app get live and CI enabled with database schema update on every push?
N.B. The project uses MySQL database, and it is set up and running on Azure. Connection strings are fine.
Here's what I get:
This is latest deployment via GitHub Actions
If there is not enough info, I will edit the question.
CodePudding user response:
I have deployed the ASP.NET MVC7 App
to Azure App service using GitHub Actions.
Initially even I got the same Content page.
If we got the content page, it means that our App is deployed successfully, but there is no default page to serve the app.
- In the deployed
Azure App Service
=>Configuratuion
=>Default Documents
, add a new documentIndex.cshtml
.
- All the deployed
files/folders
will be underwwwroot
directory.
I have tried to check over all files that are in
/home/site/wwwroot/
and mostly they are .dll files.
- Once the Application is deployed, all the files are compiled into
dll
files. You cannot find any of the forms/files (Controllers/.cshtml) directly.
My deployed Project folder Structure
- If you still get any issue, update the
web.config
file in the Kudu Consolewwwroot
directory(stdoutLogEnabledfalse
totrue
).
<aspNetCore processPath="dotnet" arguments=".\SimpleWebAppMVC.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
- Now try to access the Url,a log file will be created with the clear error description in
wwwroot
=>logs
folder.
How can I configure/deploy my project so that app get live and CI enabled with database schema update on every push?
In
Azure Portal
, while creatingAzure App Service
, enable theGitHub Actions settings
while creating theApp Service
itself.This option enables to continuously deploy the app whenever new change/commit is done in the repository.