没有OWIN认证管理器与请求相关联 [英] No OWIN authentication manager is associated with the request

查看:2337
本文介绍了没有OWIN认证管理器与请求相关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图启用owin&放后; ASPNET身份到我的网络API项目(在VS 2013 +净4.5.1)我得到了每个有效或unvalid以下错误(请求没有这样的控制器)的请求:

 <错误>
<消息方式>发生错误< /信息>
< ExceptionMessage>
没有OWIN认证管理器与请求相关联。
< / ExceptionMessage>
< ExceptionType> System.InvalidOperationException< / ExceptionType>
<&栈跟踪GT;
在System.Web.Http.Owin.PassiveAuthenticationMessageHandler.Sup$p$pssDefaultAuthenticationChallenges(Htt$p$pquestMessage要求)在System.Web.Http.Owin.PassiveAuthenticationMessageHandler< SendAsync> d__0.MoveNext()---从previous位置堆栈跟踪,其中引发异常---在System.Runtime.CompilerServices.TaskAwaiter结束.ThrowForNonSuccess(任务任务)在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)在System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()在System.Web.Http.HttpServer< SendAsync> d__0.MoveNext ()
< /堆栈跟踪>
< /错误>

我在调试模式下检查,没有异常被处理过!我也意识到,配置启动类不会被调用(实际上从未被抓调试器)。这里是code的启动:

  [汇编:OwinStartup(typeof运算(bloob.bloob.Startup))]命名空间bloob.bloob
{
    公共部分类启动
    {
        公共无效配置(IAppBuilder应用程序)
        {
            ConfigureAuth(应用);
        }
    }
}


解决方案

我发现这个问题终于来了!通过线与新创建的项目比较行,发现没有什么区别后,我查了这两个项目的参考,是的......所有的问题是缺少从包!

  Microsoft.Owin.Host.SystemWeb

我不知道为什么这个包装在包安装阶段错失但奇怪的一点是,为什么没有任何构建抛出的异常?或者没有任何dll引用错误?

After trying to enable owin & AspNet Identity to my Web Api project (in VS 2013 + .Net 4.5.1) I get the following error in each valid or unvalid(request to none exist controller) requests :

<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>
No OWIN authentication manager is associated with the request.
</ExceptionMessage>
<ExceptionType>System.InvalidOperationException</ExceptionType>
<StackTrace>
at System.Web.Http.Owin.PassiveAuthenticationMessageHandler.SuppressDefaultAuthenticationChallenges(HttpRequestMessage request) at System.Web.Http.Owin.PassiveAuthenticationMessageHandler.<SendAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()
</StackTrace>
</Error>

As I checked in debug mode, no exception is handled too! Also I realized that Configuration in Startup class is never called (indeed never caught by the debugger). here is the code for startup :

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

namespace bloob.bloob
{
    public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
        }
    }
}

解决方案

I found the problem finally! After comparing line by line with a newly created project and finding no difference , I checked references on both projects and yes!... All the problem was from missing package :

Microsoft.Owin.Host.SystemWeb

I don't know why this packaged is missed in package installation phase but the strange point is that why didn't any build exception thrown? or no any dll reference error?

这篇关于没有OWIN认证管理器与请求相关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆