Minimal API service deployed to IIS does not work

111 Views Asked by At

I have a minimal api service deployed to IIS using Azure DevOps pipeline. As the service does not work as expected (500 - Internal server error), I checked the IIS. I see that app settings cannot be read. IIS can see only the automatically generated web.config:

enter image description here

But our actual app settings are in the appsettings.json file. How can I fix this?

Here is our build pipeline:

steps:
- task: DotNetCoreCLI@2
  displayName: 'dotnet restore'
  inputs:
    command: restore
    projects: 'JdeProductDataService/**/*.csproj'
    vstsFeed: 'a1dd80rr-11bd-40dd-1234-e0195d2569db'

- task: DotNetCoreCLI@2
  displayName: 'dotnet build'
  inputs:
    projects: 'JdeProductDataService/**/*.csproj'
    arguments: '--configuration $(buildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: 'dotnet publish'
  inputs:
    command: publish
    publishWebProjects: false
    projects: 'JdeProductDataService/**/*.csproj'
    arguments: '--no-build --configuration $(BuildConfiguration) --output 
$(Build.ArtifactStagingDirectory)'
    modifyOutputPath: false

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: service'
  inputs:
    ArtifactName: service

And our release pipeline:

steps:
- task: IISWebAppDeploymentOnMachineGroup@0
  displayName: 'Deploy IIS Website/App'
  inputs:
    WebSiteName: JDEProductServiceTest
    JSONFiles: appsettings.json
0

There are 0 best solutions below