Katana在程式集內的程式集名稱空間下查找一個叫做Startup的類, 定義友好命名的Startup類 https://docs.microsoft.com/en-us/aspnet/aspnet/overview/owin-and-katana/owin-startup-class-detect ...
- 命名約定
Katana在程式集內的程式集名稱空間下查找一個叫做Startup的類,
- 通過屬性指定
[assembly: OwinStartup(typeof(OwinConsoleApp.Startup))]
- 通過配置文件
<add key="owin:appStartup" value="OwinConsoleApp.Startup1" />
定義友好命名的Startup類
<appSettings> <add key="owin:appStartup" value="ProductionConfiguration" /> </appSettings>
[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"); }); } } }
https://docs.microsoft.com/en-us/aspnet/aspnet/overview/owin-and-katana/owin-startup-class-detection