How do I fix HTTP Error 502.5 - Process Failure when hosting in IIS with dotnet core

category: [ Just Coding ] tags: [ dotnet core ] [ IIS ]
created: 13 May 2018 @ 18:53 modified: 15 May 2018 @ 00:39


I received a new error today that I haven't received before when deploying dotnet core apps. It was as the title suggest a "HTTP Error 502.5 - Process Failure" error

image

None of the suggestions had any affect and hours of Googling also didn't help either until eventually I came across a solution that worked

The Solution

I eventually found a solution on the aspnet / Hosting repo on GitHub  on issue number #1234 (funny enough it feels made up but isn't). jdownie posts the following solution

Although that solution worked for me it wasn't good enough. The problem here is that I deploy everything through TFS or VSTS so I couldn't just manually set the value.

My Solution

Although hacky, my solution works for me. similar to how the solution above worked for jdownie Smile. I'm lucky enough to be able to place an agent on my web server so I can run this method otherwise unzipping, hard coding the value from the build server and zipping up the publish package can also work.

Basically what I have done is after I web deploy I have a final phase which checks the machine Paths environment variable and sets the processPath to the first path it finds that contains dotnet.exe in it

Now on every deploy I have a running site that is guaranteed to have a valid dotnet.exe value

image

and I guess more importantly a running site Smile with tongue out

image

Conclusion

dotet core although getting mature is not quite there in all aspects and you are going to hit some issues with it that you wouldn't expect.

The great thing about this is the support from the community and Microsoft is brilliant and the decision to go dotnet core would not be a bad one Open-mouthed smile.

It also appears that something was wrong on the server which is why dotnet.exe wasn't being picked up even after a reboot but that's a investigation for another day

ABOUT ME

Gordon Beeming works at Nologo Studios in the sunny city of Durban, South Africa. He is the Lead for the Data and Services Team and has a strong focus on Developer Efficiencies and R&D. When he's not hacking away at a keyboard in Visual Studio he'll generally be relaxing with his family or hitting the black top getting in some mileage. He is a Visual Studio ALM Ranger and Visual Studio ALM MVP.

Follow me on Strava