Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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);
    }
  }
}

And on Web.Config I have the following:

<add key="owin:AutomaticAppStartup" value="false"/>

I have a breakpoint inside Startup.Configuration but this does not fire ...

Any idea why?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
638 views
Welcome To Ask or Share your Answers For Others

1 Answer

It's usually happend because SystemWeb package is not installed on your project.

Use this command at your Package Manager Console:

Install-Package Microsoft.Owin.Host.SystemWeb

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...