No owin.Environment item was found in the context

前端 未结 12 1827
心在旅途
心在旅途 2020-12-10 00:44

Microsoft recently introduced new ASP.NET Identity - replacement for old (Simple)Membership. Unfortunately, I can\'t use this new membership system in my old project because

相关标签:
12条回答
  • 2020-12-10 01:18

    adding default language to compilation in web.config did it for me!

    0 讨论(0)
  • 2020-12-10 01:19

    I had the exact same error, but as it turned out I had another configuration problem in my web.config. My web.config was missing the attribute defaultLanguage="c#" in the compilation element under system.web.

    In this case it will default to VB. So unless you have your Startup class written in VB you should change the default language to C#.

    Not correct:

    <compilation debug="true" optimizeCompilations="true" targetFramework="4.6.1">
    

    This is correct (unless you use VB):

    <compilation debug="true" defaultLanguage="c#" optimizeCompilations="true" targetFramework="4.6.1">
    
    0 讨论(0)
  • 2020-12-10 01:19

    I had the same issue, it was fixed after making sure this line was in web.config:

    <add key="owin:AutomaticAppStartup" value="true" />
    
    0 讨论(0)
  • 2020-12-10 01:19

    I tried everything mentioned on this page but nothing worked. Then I found out about a setting in IIS named owin:AutomaticAppStartup. You can find it in the Application Settings page of the IIS Manager for the Default Web Site. Check to see if that setting is true. If not set to true. This worked for me.

    This is the website where I found the answer: http://gotoanswer.stanford.edu/?q=Microsoft.Owin.Host.SystemWeb+and+still+getting+No+owin.Environment+item+was+found+in+the+context

    0 讨论(0)
  • 2020-12-10 01:23

    If you happened to have copied the below config from MVC4, you should remove it from web.config

    <add key="owin:AutomaticAppStartup" value="false" />
    
    0 讨论(0)
  • 2020-12-10 01:24

    Cleaning ASP.NET temporary files helped me with this exact problem

    0 讨论(0)
提交回复
热议问题