public void Configuration(IAppBuilder app)
{
// code is executed
}
public void ConfigureServices(IServiceCollection services)
{
// code is not executed
}
public void Configuration(IAppBuilder app)
{
// code is executed
}
public void ConfigureServices(IServiceCollection services)
{
// code is not executed
}
ConfigureServices(IServiceCollection services) method is only available in ASP.NET Core. this might help- ASP.NET Classic OWIN StartUp ConfigureServices not called
Based on OWIN Startup Class Detection, you have to add the NuGet package Microsoft.Owin.Host.SystemWeb and then reference a OWIN Startup class from VisualStudio template, then in the following code you can access OWIN:
[assembly: OwinStartup("ProductionConfiguration", typeof(StartupDemo.ProductionStartup2))]
namespace StartupDemo
{
public class ProductionStartup
{
public void Configuration(IAppBuilder app)
{
app.Run(context =>
{
string t = DateTime.Now.Millisecond.ToString();
return context.Response.WriteAsync(t + " Production OWIN App");
});
}
}
public class ProductionStartup2
{
public void Configuration(IAppBuilder app)
{
app.Run(context =>
{
string t = DateTime.Now.Millisecond.ToString();
return context.Response.WriteAsync(t + " 2nd Production OWIN App");
});
}
}
}