net.core "a path base can only be configured using iapplicationbuilder.usepathbase()" 1

net.core “a path base can only be configured using iapplicationbuilder.usepathbase()”

// Cannot set path base via applicationUrl, must set it here using UsePathBase()

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UsePathBase("/{my application name}");
            app.Run(context =>
            {
                return context.Response.WriteAsync("Hello World!");
            });
        }

Here is what the above code is Doing:
1. The UsePathBase() method is used to set the path base.
2. The path base is set to /{my application name}.
3. The path base is used to prefix the path of the request.

Similar Posts