I'm trying to publish / deploy a blazor interactive server application using an Apache server that is serving in different folders.
So, I'm trying to move the application to a specific folder.
For this, I'm following these instructions Host and deploy ASP.NET Core Blazor.
But when I run the application I get the error Connection ID required. The URL open is correct (http://localhost:5401/email2db) where email2db is the path where I want the application.
I have googled, and I see different alternatives, and I'm testing (allow CORS, specific routing mapping, ...) but I want to imagine that is very more simple than this.
What I have done until now:
- I have modified the App.razor file adding the
<base>tag
@inject WebOptions webOptions <!DOCTYPE html><html lang="en"><head>...<!-- base href="/email2db/" /--><base href="/@(webOptions.PathBase)" />NOTICE: Here I'm using an injected configuration, but I have also tested with hardcoded value
- I have modified the
program.csadding theMapBlazorHub
app.MapBlazorHub(webConfiguration.GetValue<String>("PathBase")!);NOTICE: Again, here I use a configuration, but also tested hard coded
- I have modified the
Properties/launchSettings.json
"profiles": {"http": {"commandName": "Project","dotnetRunMessages": true,"launchBrowser": true,"applicationUrl": "http://localhost:5104","launchUrl": "http://localhost:5104/email2db/","environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development" } },...Any suggestion/guide will be welcome. Have I to continue with CORS? Or with Map(...And another annoying tip. With this configuration, the server try to serve the pages from both paths http://localhost:5104/pages/mypage and http://localhost:5104/email2db/pages/mypage