I am trying to deploy my Blazor Server application under /app which is a sub application in IIS. I read on several places online that I need to set the following:
Startup.cs | app.UsePathBase("/app")
and
_Host.cshtml | <base href="~/app/" />
But when I run this I get the following error:
blazor.server.js:15 [2020-05-26T16:16:11.796Z] Error: The circuit failed to initialize.
e.log @ blazor.server.js:15
blazor.server.js:1 [2020-05-26T16:16:11.798Z] Information: Connection disconnected.
blazor.server.js:1 Uncaught (in promise) Error: Invocation canceled due to the underlying connection being closed.
at e.connectionClosed (blazor.server.js:1)
at e.connection.onclose (blazor.server.js:1)
at e.stopConnection (blazor.server.js:1)
at e.transport.onclose (blazor.server.js:1)
at e.close (blazor.server.js:1)
at e.stop (blazor.server.js:1)
at e.<anonymous> (blazor.server.js:1)
at blazor.server.js:1
at Object.next (blazor.server.js:1)
at a (blazor.server.js:1)
If I change to (without trailing slash)
_Host.cshtml | <base href="~/app" />
The application runs but without any /app before the URL (no change as far as I can see).
On some example I saw that they changed the BlazorHub path but I just cannot get it to work. The reason behind this is to be able to host application and landing page as separate IIS sites.