.NET application deployment on IIS using GitHub Actions running on Windows EC2 instance

0

Hi AWS, I am building a CI/CD pipeline for the .NET web app and while deploying the app to IIS server I am facing this issue as highlighted in the screenshot. Having said that the GitHub Actions runner is configured on AWS EC2 Windows instance using amazon/Windows_Server-2022-English-Full-Base-2023.08.10 AMI.

.NET application deployment on IIS Server

This is the pipeline code:

name: "Deploying a CI/CD for .NET sample app using GitHub Actions"

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

jobs:
  build:

    runs-on: [ self-hosted, Windows, X64 ]


    steps:
    - name: Checkout code repository
      uses: actions/checkout@v3
    - name: Install .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '7.0'
        include-prerelease: True
    - name: Display dotnet version
      run: dotnet --version
    - name: Restore dependencies
      run: dotnet restore
    # dotnet build and publish
    - name: Build with dotnet
      run: dotnet build --configuration Release --no-restore
    - name: dotnet publish
      run: |
        dotnet publish --configuration Release --no-restore
    # IIS Deployment
    - name: Deploy to IIS Server
      run: |
        iisreset /stop
        Copy-Item ./MyWebApp/* C:/inetpub/wwwroot/MyWebApp -Recurse -Force
        iisreset /start
    # - name: Curl the website as a smoke test
    #   run: curl http://localhost/

    # - name: Run Web Test
    #   run: |
    #     dotnet build --configuration Release .\dotnet-core-webapp.webtest
    #     cd .\dotnet-core-webapp.webtests
    #     dotnet test
    # - name: Test
    #   run: dotnet test --no-build --verbosity normal
    # - name: Run the WebApp
    #   run: dotnet watch
profile picture
Arjun
gefragt vor 8 Monaten286 Aufrufe
1 Antwort
0

any solution for this issue ? how we can start stop of IIS server on window EC2 server.

This code is not working at all - name: Stop IIS run: | Start-Process -FilePath "iisreset" -ArgumentList "/stop" -Verb RunAs shell: powershell

- name: dotnet publish
  run: dotnet publish -c Release -o C:\inetpub\atarifujiq\publish

- name: Start IIS
  run: |
    Start-Process -FilePath "iisreset" -ArgumentList "/start" -Verb RunAs
  shell: powershell
vikash
beantwortet vor 2 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen