Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deployment error: "The requested page cannot be accessed because the related configuration data for the page is invalid"

What happens?

I publish a website to UnoEuro on a windows server.

When I do I keep getting the error message:

"HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid."

What have I set up/tried?

What I've done is that I've created a .NET Core 2.1 Web API which hosts fine locally on my computer using IIS. I have then published the web api to the hosting site UnoEuro where I can see that the files are uploaded as they should be.

I asked the hosting sites support, they told me to just ensure that it was deployed as self-contained but that otherwise they could not help further. It looks like there is a hosting issue of some sort related to that it cannot seem to find the webconfig file. At least that's what the error message says.

Is there any form of setup I should make? A configuration I should change? Should I set up some SSL settings in the web API which I might have missed? When I started the project I told it to enforce HTTPS, but surely I should get another error message if that was the fault?

I've tried publishing with the target runtime set to both x64 and x86.

I've never published an API like this to anything but Azure before, so I might be doing a thing or two wrong but I cannot see what it should be? I have Googled around but not found anything that seems relevant which has worked.

Most of the solutions seem related to changing the server environment which I don't have so much control over, I mostly just have control over the application/web api, at least that's what it looks like to me.

Hope you have any suggestions, I'm all eyes n ears.

Side question: Should I use IIS Manager for this? I'm currently publishing through Visual Studio 2017.

Images for further understanding

Publishing settings

Publish info

Deployed/published files

Deployedfiles

Error message I get

Error message

EDIT:

I tried moving the files to /public_html on the same domain as ISS Manager seemed to indicate it expected the config file to be there.

That then resulted in a different error message as you see below.

Link from error message: https://go.microsoft.com/fwlink/?LinkID=808681

new error message

like image 565
Doh09 Avatar asked Oct 29 '25 22:10

Doh09


1 Answers

It's hard to say exactly, but I think the issue is that the ASP.NET Core hosting bundle is not installed on the server. There's two pieces to hosting in IIS. First, you need the .NET Core runtime, and then you need the ASP.NET Core hosting module for IIS. Deploying as self-contained buys you the runtime, but not the hosting module in IIS. There's non-standard sections in the Web.config created by publishing an ASP.NET Core app. The hosting module shims in support in IIS for these config sections (among other things). Therefore, the config error seems to imply that this is not happening.

If you don't control the server, there's not much you can do about it. Honestly, at this point, I wouldn't host anywhere where you do not at least have some measure of control over the environment. You can get a full VPS from numerous hosting services for $5 or less a month. Either continue hosting in Azure, or look into other respected cloud providers like DigitalOcean, AWS, etc.

like image 135
Chris Pratt Avatar answered Nov 02 '25 04:11

Chris Pratt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!