OwinStartup 不启动... 为什么? [英] OwinStartup not Starting ... Why?
本文介绍了OwinStartup 不启动... 为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 ASP.NET MVC 5 站点上有以下类:
I have the following class on an ASP.NET MVC 5 site:
[assembly: OwinStartup(typeof(MVCSite.Startup))]
namespace MVCSite {
public partial class Startup {
public void Configuration(IAppBuilder application) {
application.UseCookieAuthentication(new CookieAuthenticationOptions {
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
application.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
}
}
}
在 Web.Config 上,我有以下内容:
And on Web.Config I have the following:
<add key="owin:AutomaticAppStartup" value="false"/>
我在 Startup.Configuration 中有一个断点,但这不会触发......
I have a breakpoint inside Startup.Configuration but this does not fire ...
知道为什么吗?
推荐答案
这通常是因为您的项目中未安装 SystemWeb 包.
It's usually happend because SystemWeb package is not installed on your project.
在包管理器控制台中使用此命令:
安装包 Microsoft.Owin.Host.SystemWeb
另一方面,如果上述解决方案不起作用,您可以在 app.config 或 web.config 上使用此配置:
In the other hand you may use this configuration on your app.config or web.config if the above solution is not work:
<appSettings>
<add key="owin:AutomaticAppStartup" value="true"/>
</appSettings>
这篇关于OwinStartup 不启动... 为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文