An open API service indexing awesome lists of open source software.

https://github.com/ebyte23/usepathbase

UsePathBase for aspnetcore 1.0 and UsePathEnvironment()
https://github.com/ebyte23/usepathbase

Last synced: 8 months ago
JSON representation

UsePathBase for aspnetcore 1.0 and UsePathEnvironment()

Awesome Lists containing this project

README

          

# UsePathBase
UsePathBase for aspnetcore 1.0 and UsePathEnvironment()

Thanks to Microsoft and community for original code.

This allows you to define sites pathbase in an environment variable and make it optional.

```
Linux
env ASPNETCORE_APPL_PATH=/app1

Windows
SET ASPNETCORE_APPL_PATH=/app1
```

```Install-Package ebyte23.UsePathBase```

You must put this at the top of your apps configure like so.

```
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
//This should be your first middleware
app.UsePathBaseEnvironment(true);

app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
```