I\'m developing an ASP.NET Core application. My application hosted with NGinx on url http://somedomain.com/MyApplication
.
I need all requests routed to
you can use the PathBase
middleware just before Mvc
like this :
partial class Startup {
public void Configure(
IApplicationBuilder app,
IHostingEnvironment env
) {
app.UsePathBase(new PathString("/MyApplication"));
app.UseMvc();
}
}
with the PathBase
middleware, no need to change any mvc code, it will automatically add to the request and response.
please refer to https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.usepathbaseextensions.usepathbase?view=aspnetcore-2.2