Blazor Server Responds with HTML Instead of JSON When Deployed to Azure

Viewed 174

I have a server hosted Blazor application that works perfectly fine in my development environment. However, when I deploy the application to Azure the server responds with "text/html" instead of "application/json".

To simplify and test this I wrote a very basic "Hello World" end point that simply replies with a json object. When I navigate directly to this endpoint from my development environment the server responds with "application/json".

enter image description here

When I deploy the application to Microsoft Azure and then navigate to the exact same endpoint the server responds with "text/html".

enter image description here

To reiterate, I'm not changing any code between environments and I'm navigating to the exact same endpoint. What am I missing?

EDIT

As a test I went and created a completely vanilla .NET Core 5 Blazor WASM Application. This is a server hosted app. When I run it locally everything works great. When I deploy it to Azure I get the EXACT SAME ERROR that I'm getting in the application I'm trying to write. To me, this is more evidence that it is something to do with how Azure Web Apps are configured or some other Azure related issue.

THIS IS THE APP WHEN I LOAD IT FROM THE SERVER:

enter image description here

THIS IS THE PREVIEW FROM DEV TOOLS

enter image description here

THIS IS THE EXCEPTION FROM THE CONSOLE

enter image description here

Something is clearly going on when I publish this to Azure.

0 Answers
Related