0

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
David Shochet
  • 5,035
  • 11
  • 57
  • 105
  • You need more information to analyze your problem, try using failed request tracing to see details about 500 error, this will generate detail log file, which will help you to identify the problem. – samwu Aug 24 '23 at 02:12
  • @samwu But doesn't the fact that appsettings.json is not read speak for itself? could you please give me some reference to what I should do to get that failed request tracing? Thank you! – David Shochet Aug 24 '23 at 11:49
  • @samwu I cannot open failed request tracing, as well as other items on IIS for that particular website: There was an error while performing this operation. I get this: Details: Filename: \\?\C:\inetpub\wwwroot\JDEDataService\Web.config Error: – David Shochet Aug 24 '23 at 18:27
  • @samwu I deployed the same project manually (without any pipeline), with the same result. – David Shochet Aug 24 '23 at 20:27
  • This is not what I want, you can refer to this link to use the failed request trace to troubleshoot: [Troubleshoot failed requests using tracing in IIS](https://learn.microsoft.com/en-us/previous-versions/troubleshoot/iis/troubleshoot-failed-requests-using-tracing-in-iis-7). – samwu Aug 25 '23 at 07:15
  • @samwu I followed this manual until I reached "Double-click Failed Request Tracing Rules." As I mentioned earlier, this gives me an error with empty Details. So I cannot proceed. :( Though I did it for my site rather than for the default site, which does not exist in my IIS. – David Shochet Aug 25 '23 at 12:02
  • Can you post the xml file for the failed request trace? – samwu Aug 29 '23 at 08:46
  • @samwu Where can I get it? – David Shochet Aug 29 '23 at 13:34
  • As I mentioned earlier, I cannot open "Failed Request Tracing Rules". – David Shochet Aug 29 '23 at 18:40
  • 1
    [https://learn.microsoft.com/en-us/answers/questions/1354835/minimal-api-service-deployed-to-iis-does-not-work](https://learn.microsoft.com/en-us/answers/questions/1354835/minimal-api-service-deployed-to-iis-does-not-work). – samwu Sep 01 '23 at 05:18

0 Answers0