Unravel provides a fully configurable ASP.NET Core IWebHost
on top of System.Web
via OWIN, with forward-compatible dependency injection, configuration and logging.
Unravel.Application
- Inherits from
System.Web.HttpApplication
- Provides OWIN Startup
- Provides ASP.NET Core Startup, including
ConfigureServices(IServiceCollection)
- Builds an ASP.NET Core
IWebHost
, including anIServiceProvider
- Static
Unravel.Application.Services
service locator - Scoped per
HttpContext
- With
GetRequestServices()
extension methods
- Static
- Inherits from
OwinHost.CreateDefaultBuilder()
, equivalent toWebHost.CreateDefaultBuilder()
.Microsoft.Extensions.Configuration
ConfigurationManagerConfigurationProvider
inspired by @benfosterappsettings.json
andappsettings.{env}.json
- User Secrets (Development only)
- Environment Variables
Microsoft.Extensions.DependencyInjection
Microsoft.Extensions.Logging
- Configured from
IConfiguration
- Debug Logger
- Configured from
-
Install
Unravel.Startup
in your Web Application project -
Search the project for an existing OWIN Startup Class:
-
There may be an
OwinStartup
attribute, e.g.[assembly: OwinStartup(typeof(UnravelExamples.Web.OwinStartup))]
-
Web.config
may containowin:appStartup
, e.g.<appSettings> <add key="owin:appStartup" value="UnravelExamples.Web.OwinStartup" /> </appSettings>
In the instructions that follow, use that class name instead of
Startup
(or rename it toStartup
). -
-
Open
Global.asax.cs
:- Rename the class to
Startup
- Make the class
partial
- Inherit from
Unravel.Application
-public class MvcApplication : System.Web.HttpApplication +public partial class Startup : Unravel.Application
Make sure the
Inherits
inGlobal.asax
updated, too-<%@ Application CodeBehind="Global.asax.cs" Inherits="UnravelExamples.Web.MvcApplication" Language="C#" %> +<%@ Application CodeBehind="Global.asax.cs" Inherits="UnravelExamples.Web.Startup" Language="C#" %>
- Rename the class to
-
If you already have a
Startup.cs
:- Make it
partial
- Replace
void Configuration(IAppBuilder app)
withoverride void ConfigureOwin(IAppBuilder app)
If you don't, create one.
Then you can
override ConfigureServices()
, too.// Startup.cs public partial class Startup { public override void ConfigureServices(IServiceCollection services) { } public override void ConfigureOwin(IAppBuilder app) { } }
- Make it