尝试验证Web应用程序时出错:未找到Owin Enviroment项目

时间:2019-01-31 14:14:35

标签: owin

您好,我试图通过azure对我的Web应用程序进行身份验证,但收到错误消息:未找到Owin Enviroment项目

我四处寻找一个礼物,

尝试:

清理临时文件

 <appSettings><add key="owin:AppStartup" value="[Namespace].Startup, [AssemblyName]" /></appSettings>

AND ...

<compilation debug="true" defaultLanguage="c#" optimizeCompilations="true" targetFramework="4.6.1"> 

AND ...

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

(顺便说一句[项目是我的项目的名称])

我的代码:

    using Microsoft.Owin.Security;
    using Microsoft.Owin.Security.Cookies;
    using Microsoft.Owin.Security.OpenIdConnect;
    using System.Security.Claims;
    using System.Web;
    using System.Web.Mvc;
    using [Project].TokenStorage;
    using System.Net.Http;
    using Microsoft.Owin;

    [assembly: OwinStartup(typeof([Project].Startup))]


    namespace [Project].Controllers
    {
        public class AccountController : Controller
        {
            public void SignIn()
            {
                if (!System.Web.HttpContext.Current.Request.IsAuthenticated)
                {
                    // Signal OWIN to send an authorization request to Azure
                    System.Web.HttpContext.Current.Request.GetOwinContext().Authentication.Challenge(
                        new AuthenticationProperties { RedirectUri = "/" },
                        OpenIdConnectAuthenticationDefaults.AuthenticationType);
                }
            }

非常感谢任何帮助。

0 个答案:

没有答案