本文介绍了ELMAH显示,[否OWIN认证管理器与请求关联&QUOT。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的日志ELMAH是显示这个错误。这是不是对每个请求的发生。它的发生间歇性。 MVC 5.2的Web API 2.2,ASP.NET身份2和Azure的网站是我的环境。
更新:这是我Startup.cs,

  OAuthOptions =新OAuthAuthorizationServerOptions()
        {
            AllowInsecureHttp = TRUE,
            TokenEndpointPath =新PathString(/标记),
            AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(settings.AccessTokenExpireTimeSpanInMinutes)
            供应商=新MyAuthorizationServerProvider()
            RefreshTokenProvider =新MyRefreshTokenProvider()
        };
        //网页API的配置和服务
        //配置Web API只使用承载令牌认证。
        GlobalConfiguration.Configuration.Sup pressDefaultHostAuthentication();
        GlobalConfiguration.Configuration.Filters.Add(新HostAuthenticationFilter(OAuthOptions.AuthenticationType));
        app.UseOAuthAuthorizationServer(OAuthOptions);
        app.UseOAuthBearerAuthentication(OAuthBearerOptions);        GlobalConfiguration.Configuration.Sup pressDefaultHostAuthentication();
        GlobalConfiguration.Configuration.Filters.Add(新HostAuthenticationFilter(OAuthOptions.AuthenticationType));

选中此No OWIN认证管理器与请求的关联,但不工作

  System.InvalidOperationException:没有OWIN认证管理器与请求相关联。
   在System.Web.Http.HostAuthenticationFilter.GetAuthenticationManagerOrThrow(HTT prequestMessage要求)
   在System.Web.Http.HostAuthenticationFilter< AuthenticateAsync> d__0.MoveNext()
---从previous位置堆栈跟踪,其中引发异常的结尾---
   在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
   在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
   在System.Web.Http.Tracing.ITraceWriterExtensions< TraceBeginEndAsyncCore> d__24.MoveNext()
---从previous位置堆栈跟踪,其中引发异常的结尾---
   在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
   在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
   在System.Web.Http.Controllers.AuthenticationFilterResult< ExecuteAsync> d__0.MoveNext()
---从previous位置堆栈跟踪,其中引发异常的结尾---
   在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
   在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
   在System.Web.Http.Tracing.Tracers.HttpControllerTracer< ExecuteAsyncCore> d__5.MoveNext()
---从previous位置堆栈跟踪,其中引发异常的结尾---
   在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
   在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
   在System.Web.Http.Tracing.ITraceWriterExtensions< TraceBeginEndAsyncCore> d__18`1.MoveNext()
---从previous位置堆栈跟踪,其中引发异常的结尾---
   在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
   在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
   在System.Web.Http.Dispatcher.HttpControllerDispatcher< SendAsync> d__0.MoveNext()
---从previous位置堆栈跟踪,其中引发异常的结尾---
   在System.Web.Http.Dispatcher.HttpControllerDispatcher< SendAsync> d__0.MoveNext()
---从previous位置堆栈跟踪,其中引发异常的结尾---
   在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
   在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
   在System.Web.Http.Owin.PassiveAuthenticationMessageHandler< SendAsync> d__0.MoveNext()
---从previous位置堆栈跟踪,其中引发异常的结尾---
   在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
   在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
   在System.Web.Http.Tracing.ITraceWriterExtensions< TraceBeginEndAsyncCore> d__18`1.MoveNext()
---从previous位置堆栈跟踪,其中引发异常的结尾---
   在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
   在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
   在System.Web.Http.Tracing.ITraceWriterExtensions< TraceBeginEndAsyncCore> d__18`1.MoveNext()
---从previous位置堆栈跟踪,其中引发异常的结尾---
   在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
   在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
   在System.Web.Http.HttpServer< SendAsync> d__0.MoveNext()

我能够reproduct它在我的电脑。只需重新启动应用程序域和发送到API的请求。我将获得上述错误。这一切后,将被罚款。这里是堆栈跟踪从我的本地机器上,

  Project.Api.dll!Project.Api.Helpers.ElmahExceptionHandler.Handle(System.Web.Http.ExceptionHandling.ExceptionHandlerContext上下文)第22行C#
System.Web.Http.dll!System.Web.Http.ExceptionHandling.ExceptionHandler.HandleAsync(System.Web.Http.ExceptionHandling.ExceptionHandlerContext背景下,System.Threading.CancellationToken的CancellationToken)未知
System.Web.Http.dll!System.Web.Http.ExceptionHandling.ExceptionHandler.System.Web.Http.ExceptionHandling.IExceptionHandler.HandleAsync(System.Web.Http.ExceptionHandling.ExceptionHandlerContext背景下,System.Threading.CancellationToken的CancellationToken)未知
System.Web.Http.dll!System.Web.Http.ExceptionHandling.LastChanceExceptionHandler.HandleAsync(System.Web.Http.ExceptionHandling.ExceptionHandlerContext背景下,System.Threading.CancellationToken的CancellationToken)未知
System.Web.Http.dll!System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore()未知
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore>(ref System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore的statemachine)未知
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.Start<System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore>(ref System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore的statemachine)未知
System.Web.Http.dll!System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore(System.Web.Http.ExceptionHandling.IExceptionHandler处理程序,System.Web.Http.ExceptionHandling.ExceptionHandlerContext背景下,System.Threading.CancellationToken的CancellationToken)未知
System.Web.Http.dll!System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsync(System.Web.Http.ExceptionHandling.IExceptionHandler处理程序,System.Web.Http.ExceptionHandling.ExceptionContext背景下,System.Threading.CancellationToken的CancellationToken)未知
System.Web.Http.dll!System.Web.Http.HttpServer.SendAsync()未知
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<System.Web.Http.HttpServer.SendAsync>(ref System.Web.Http.HttpServer.SendAsync的statemachine)未知
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.Start<System.Web.Http.HttpServer.SendAsync>(ref System.Web.Http.HttpServer.SendAsync的statemachine)未知
System.Web.Http.dll!System.Web.Http.HttpServer.SendAsync(System.Net.Http.Htt prequestMessage要求,System.Threading.CancellationToken的CancellationToken)未知
System.Net.Http.dll!System.Net.Http.HttpMessageInvoker.SendAsync(System.Net.Http.Htt prequestMessage要求,System.Threading.CancellationToken的CancellationToken)未知
System.Web.Http.WebHost.dll!System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore()未知
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore>(ref System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore的statemachine)未知
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore>(ref System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore的statemachine)未知
System.Web.Http.WebHost.dll!System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore(System.Web.HttpContextBase contextBase)未知
System.Web.Http.WebHost.dll!System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsync(System.Web.HttpContext上下文)未知
System.Web.dll!System.Web.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest.AnonymousMethod__0()未知
!System.Web.dll中System.Web.TaskAsyncHelper.BeginTask(System.Func&LT; System.Threading.Tasks.Task&GT; taskFunc,System.AsyncCallback回调,对象的状态)未知
System.Web.dll!System.Web.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext背景下,System.AsyncCallback CB,反对extraData)未知
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()未知
System.Web.dll中!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep步,参考布尔completedSynchronously)未知
System.Web.dll中!System.Web.HttpApplication.PipelineStepManager.ResumeSteps(System.Exception的错误)未知
System.Web.dll中!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext背景下,System.AsyncCallback CB)未知
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest WR,System.Web.HttpContext上下文)未知
System.Web.dll中!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer,System.IntPtr nativeRequestContext,System.IntPtr moduleData,诠释标志)未知
System.Web.dll中!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer,System.IntPtr nativeRequestContext,System.IntPtr moduleData,诠释标志)未知
[原产于托管过渡]
[托管到本机转换]
System.Web.dll中!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer,System.IntPtr nativeRequestContext,System.IntPtr moduleData,诠释标志)未知
System.Web.dll中!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer,System.IntPtr nativeRequestContext,System.IntPtr moduleData,诠释标志)未知
[AppDomain中转换]

不是我使用OAuth服务器在SPA模板可用。

  CONFIG.SUP pressDefaultHostAuthentication();
config.Filters.Add(新HostAuthenticationFilter(Startup.OAuthOptions.AuthenticationType));


解决方案

解决方法是使用Microsoft.AspNet.WebApi.Owin(UseOwinMethod)。这也固定后,HTTP标头已经发送了服务器不能追加头。。我发现这个包的错误也可以是变通Why的MessageHandler在MVC要求执行?
相关

My elmah logs is showing this error. This is not happening with every requests. It happening intermittently. MVC 5.2, Web API 2.2, ASP.NET Identity 2 and Azure website is my environment. update: Here is my Startup.cs,

        OAuthOptions = new OAuthAuthorizationServerOptions()
        {
            AllowInsecureHttp = true,
            TokenEndpointPath = new PathString("/token"),
            AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(settings.AccessTokenExpireTimeSpanInMinutes),
            Provider = new MyAuthorizationServerProvider(),
            RefreshTokenProvider = new MyRefreshTokenProvider()
        };
        // Web API configuration and services
        // Configure Web API to use only bearer token authentication.
        GlobalConfiguration.Configuration.SuppressDefaultHostAuthentication();
        GlobalConfiguration.Configuration.Filters.Add(new HostAuthenticationFilter(OAuthOptions.AuthenticationType));
        app.UseOAuthAuthorizationServer(OAuthOptions);
        app.UseOAuthBearerAuthentication(OAuthBearerOptions);

        GlobalConfiguration.Configuration.SuppressDefaultHostAuthentication();
        GlobalConfiguration.Configuration.Filters.Add(new HostAuthenticationFilter(OAuthOptions.AuthenticationType));

Checked this No OWIN authentication manager is associated with the request but not working

System.InvalidOperationException: No OWIN authentication manager is associated with the request.
   at System.Web.Http.HostAuthenticationFilter.GetAuthenticationManagerOrThrow(HttpRequestMessage request)
   at System.Web.Http.HostAuthenticationFilter.<AuthenticateAsync>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.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__24.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.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>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.Web.Http.Tracing.Tracers.HttpControllerTracer.<ExecuteAsyncCore>d__5.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.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.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.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<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.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.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.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.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.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.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()

I was able to reproduct it in my PC. Just restart the app domain and send a request to api. I will get the above error. After that everything will be fine. Here is StackTrace from my local machine,

    Project.Api.dll!Project.Api.Helpers.ElmahExceptionHandler.Handle(System.Web.Http.ExceptionHandling.ExceptionHandlerContext context) Line 22 C#
System.Web.Http.dll!System.Web.Http.ExceptionHandling.ExceptionHandler.HandleAsync(System.Web.Http.ExceptionHandling.ExceptionHandlerContext context, System.Threading.CancellationToken cancellationToken) Unknown
System.Web.Http.dll!System.Web.Http.ExceptionHandling.ExceptionHandler.System.Web.Http.ExceptionHandling.IExceptionHandler.HandleAsync(System.Web.Http.ExceptionHandling.ExceptionHandlerContext context, System.Threading.CancellationToken cancellationToken) Unknown
System.Web.Http.dll!System.Web.Http.ExceptionHandling.LastChanceExceptionHandler.HandleAsync(System.Web.Http.ExceptionHandling.ExceptionHandlerContext context, System.Threading.CancellationToken cancellationToken)   Unknown
System.Web.Http.dll!System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore()  Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore>(ref System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore stateMachine)  Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.Start<System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore>(ref System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore stateMachine)  Unknown
System.Web.Http.dll!System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsyncCore(System.Web.Http.ExceptionHandling.IExceptionHandler handler, System.Web.Http.ExceptionHandling.ExceptionHandlerContext context, System.Threading.CancellationToken cancellationToken)  Unknown
System.Web.Http.dll!System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.HandleAsync(System.Web.Http.ExceptionHandling.IExceptionHandler handler, System.Web.Http.ExceptionHandling.ExceptionContext context, System.Threading.CancellationToken cancellationToken) Unknown
System.Web.Http.dll!System.Web.Http.HttpServer.SendAsync()  Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<System.Web.Http.HttpServer.SendAsync>(ref System.Web.Http.HttpServer.SendAsync stateMachine)  Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.Start<System.Web.Http.HttpServer.SendAsync>(ref System.Web.Http.HttpServer.SendAsync stateMachine)  Unknown
System.Web.Http.dll!System.Web.Http.HttpServer.SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)  Unknown
System.Net.Http.dll!System.Net.Http.HttpMessageInvoker.SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)  Unknown
System.Web.Http.WebHost.dll!System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore() Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore>(ref System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore stateMachine)    Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore>(ref System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore stateMachine)    Unknown
System.Web.Http.WebHost.dll!System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore(System.Web.HttpContextBase contextBase)   Unknown
System.Web.Http.WebHost.dll!System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsync(System.Web.HttpContext context)   Unknown
System.Web.dll!System.Web.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest.AnonymousMethod__0()    Unknown
System.Web.dll!System.Web.TaskAsyncHelper.BeginTask(System.Func<System.Threading.Tasks.Task> taskFunc, System.AsyncCallback callback, object state) Unknown
System.Web.dll!System.Web.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext context, System.AsyncCallback cb, object extraData)  Unknown
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  Unknown
System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously)  Unknown
System.Web.dll!System.Web.HttpApplication.PipelineStepManager.ResumeSteps(System.Exception error)   Unknown
System.Web.dll!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext context, System.AsyncCallback cb)  Unknown
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest wr, System.Web.HttpContext context)    Unknown
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) Unknown
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)   Unknown
[Native to Managed Transition]  
[Managed to Native Transition]  
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) Unknown
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)   Unknown
[AppDomain Transition]  

Not I am using OAuth server that is available in SPA template.

config.SuppressDefaultHostAuthentication();
config.Filters.Add(new HostAuthenticationFilter(Startup.OAuthOptions.AuthenticationType));
解决方案

The fix is to use Microsoft.AspNet.WebApi.Owin(UseOwinMethod). This also fixed the Server cannot append header after HTTP headers have been sent.. I have found a bug in this package which can also be work-around Why MessageHandler is executing in MVC request?Related http://katanaproject.codeplex.com/discussions/540202

这篇关于ELMAH显示,[否OWIN认证管理器与请求关联&QUOT。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 02:56