How to resolve error with OWIN?

Asked

Viewed 149 times

3

Well friends, I created an Asp.Net MVC web project No Authentication, but now I’m in need of authentication.

I’m following some tutorials like that to put authentication from scratch, but after installing the Entityframework and OWIN had problems running the project:

No owin.Environment item was found in the context.

Description: An untreated exception occurred during the execution of the current web request. Examine stack tracking to get more information about the error and where it originated in the code.

Details of the Exception: System.Invalidoperationexception: No owin. Environment item was found in the context.

Does anyone know why and how I can solve this problem?

  • This guy here "http://stackoverflow.com/questions/22650168/no-owin-environment-item-was-found-in-the-context-only-on-server" Decided to restart the server.

  • I restarted, but unfortunately it didn’t work.

  • Have you created another? If you can start a new one, choose with authentication. Expand your project’s file tree on Solution Explorer, and send an image of the contained files you created to the ASP.NET Identity.

  • Well friend, that’s the biggest problem! I can’t create another project with Authentication and migrate my current project there. I am using Telerik and if I did that it would not work. It has to be in this project that I am already working.

  • @Jedaias, ok, so try to give a better position on what you’ve done with Identity.

  • Well, I imported (copied and pasted) the classes IdentityModels and AccountViewModels of another project created using the Authentication , I’m also using the classes AccountController and IdentityConfig in the same way. But through the Package Manager Console installed the EntityFramwork and the OWIN.

  • To Startup.cs, copied?

  • There was copied no, I copied now, but the same error continues. I believe I should configure something in the Web.config

Show 3 more comments

2 answers

0

You need to create a Statup Class:

inserir a descrição da imagem aqui

0

  • Check if there is a Startup Class in your project;
  • Check whether the Startup Class has the following annotation before the class declaration:

    [assembly: OwinStartupAttribute(typeof(MeuProjeto.Startup))]
    

Browser other questions tagged

You are not signed in. Login or sign up in order to post.