ASP.NET OwinStartupAttribute
ASP.NET OwinStartupAttribute
在创建新的 ASP.NET MVC 应用程序 (4.6.1) 并让它自动配置授权时,它会在启动 Class 的顶部添加注释:
[assembly: OwinStartupAttribute(typeof(MyProject.Startup))]
但据我所知,当我只使用启动 class 时,不需要这样做,因为它已经被识别为默认启动 class。我发现有些人说 Startup class 就足够了,而其他人说你应该添加 OwinStartupAttribute.
是 惯例是使用 class 名称 Startup,katana 会查找它,但如果您想将其命名为 Startup 以外的任何名称,则必须使用该属性
例如我的启动 class 被命名为:AppStartup 然后我将使用
[assembly: OwinStartup(typeof(StartupDemo.AppStartup))]
如需进一步阅读,请关注:
http://www.asp.net/aspnet/overview/owin-and-katana/owin-startup-class-detection
在创建新的 ASP.NET MVC 应用程序 (4.6.1) 并让它自动配置授权时,它会在启动 Class 的顶部添加注释:
[assembly: OwinStartupAttribute(typeof(MyProject.Startup))]
但据我所知,当我只使用启动 class 时,不需要这样做,因为它已经被识别为默认启动 class。我发现有些人说 Startup class 就足够了,而其他人说你应该添加 OwinStartupAttribute.
是 惯例是使用 class 名称 Startup,katana 会查找它,但如果您想将其命名为 Startup 以外的任何名称,则必须使用该属性 例如我的启动 class 被命名为:AppStartup 然后我将使用
[assembly: OwinStartup(typeof(StartupDemo.AppStartup))]
如需进一步阅读,请关注:
http://www.asp.net/aspnet/overview/owin-and-katana/owin-startup-class-detection