Ich habe viele Beiträge zu diesem Thema gelesen, kann aber immer noch nicht funktionieren. Ich benutze Visual Studio 2013. Ich habe ein neues MVC 5-Projekt erstellt und dachte, es wäre cool, die neue Facebook-Login-Integration zu verwenden. Es funktioniert gut auf meinem PC in IIS Express.Microsoft.Owin.Host.SystemWeb und immer noch No Es wurde kein owin.Environment-Element im Kontext gefunden
Aber wenn ich es auf den Production-Server hochladen bekomme ich immer die sehr nervige "No owin.Environment Artikel wurde im Kontext gefunden" Nachricht.
Folgendes habe ich getan.
- Ich habe nie den Namen meines Projekts oder der Baugruppe geändert.
- Der Montage Name ist Wodivate
- Der Namespace Wodivate ist
ich die Standard-Startup.cs Klasse haben, die folgende enthält:
using Microsoft.AspNet.Identity; using Microsoft.Owin; using Microsoft.Owin.Security.Cookies; using Owin; using System.Web.Http; [assembly: OwinStartupAttribute(typeof(Wodivate.Startup))] namespace Wodivate { public partial class Startup { public void Configuration(IAppBuilder app) { ConfigureAuth(app); } } }
Im App_Start ein Startup.Auth ist. cs-Datei mit folgendem Inhalt:
using Microsoft.AspNet.Identity; using Microsoft.Owin; using Microsoft.Owin.Security.Cookies; using Owin; namespace Wodivate { public partial class Startup { // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864 public void ConfigureAuth(IAppBuilder app) { // Enable the application to use a cookie to store information for the signed in user app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login") }); // Use a cookie to temporarily store information about a user logging in with a third party login provider app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); // Uncomment the following lines to enable logging in with third party login providers //app.UseMicrosoftAccountAuthentication( // clientId: "", // clientSecret: ""); //app.UseTwitterAuthentication( // consumerKey: "", // consumerSecret: ""); var facebookOptions = new Microsoft.Owin.Security.Facebook.FacebookAuthenticationOptions() { AppId = "xxxxxxxxxxxxxxxxxxx", AppSecret = "xxxxxxxxxxxxxxxxxxxxxxxxx" }; facebookOptions.Scope.Add("email"); //We want to get user's email information by adding it in scope. app.UseFacebookAuthentication(facebookOptions); //app.UseGoogleAuthentication(); } } }
Meine Web.config-Datei enthält:
<add key="owin:AppStartup" value="Wodivate.Startup, Wodivate" /> <add key="owin:AutomaticAppStartup " value="false" />
ich auch die Post auf No owin.Environment item was found in the context - only on server und installiert sorgte dafür, dass Microsoft.Owin.Host.SystemWeb
Noch jemand auf diese stecken folgen? Ich habe 3 Tage lang eine Wand geschlagen.
Duplizieren: http://stackoverflow.com/questions/18232549/no-owin-environment-item-was-found-in-the-context –
Ich sah diesen Beitrag zu Morten, aber es hat nicht für mich funktioniert .Schauen, um zu sehen, ob jemand all diese Posts gesehen hat und immer noch feststeckend ist oder etwas anderes gefunden hat, um es zu lösen. Es ist einfach so komisch. – user3562747
Stellen Sie sicher, dass Ihre Web.config es wirklich an den richtigen Platz auf Ihrem Produktionsserver geschafft hat ... – Dunken