Kelvin Perry

Kelvin Perry

  • NA
  • 7
  • 2.3k

How to: Set default path to ASP.Net Core routing

Apr 27 2020 9:37 PM
I want to serve two ASP.Net web applications from the same server. One is MVC - which is the main site - and the other Blazor - which is a side application that will be called from the main site.
 
I have bound the two apps to different ports:
 
Blazor:   webBuilder.UseUrls("http://0.0.0.0:5001");
MVC:     webBuilder.UseUrls("http://0.0.0.0:5000");
 
I have set up Apache as a proxy and requests are directed like this:
 
    ProxyPass /blazor http://127.0.1.1:5001/
    ProxyPassReverse /blazor http://127.0.1.1:5001/
    ProxyPass / http://127.0.1.1:5000/
    ProxyPassReverse / http://127.0.1.1:5000/
 
The proxy works but the Blazor app doesn't work correctly as the rounting and data folders don't preceed their calls with /blazor.
 
In order to get the Blazor app to work correctly I assume I need to alter the default path for routing in code, but I'm not sure how to go about this.
 
I suspect I need to pass IApplicationBuilder:UseRouting() the info....
 
can anyone assist?
 
Thanks
 

Answers (1)