Asp.net不允许多个用户登录 [英] Asp.net does not allow more than one user logged in
问题描述
您好,
我在IIS 8.5上运行了2个应用程序。这两个应用程序都需要身份验证对于身份验证,我使用了身份数据模型。当我从调试器运行应用程序时,我没有问题,当时登录多个用户。
当我将它们带到IIS时,应用程序不允许当时更多的是一个用户,他们将用户重定向到登录页面(没有错误消息)。如果我重新启动IIS,应用程序允许多用户一段时间,然后他们不会。
我正在使用.NET framework 4.5.2
我在服务器的事件查看器上收到此警告:
异常信息:
异常类型:HttpException
异常消息:在发送HTTP标头后,服务器无法追加标头。
at System.Web.HttpHeaderCollection.SetHeader(String name,String value,Boolean replace)
at System.Web.HttpHeaderCollection.Set(String name,String value)
at Microsoft.Owin。 Host.SystemWeb.CallHeaders.AspNetResponseHeaders.Set(String key,String [] values)
at Microsoft.Owin.Host.SystemWeb.CallHeaders.AspNetResponseHeaders.set_Item(String key,String [] value)
at Microsoft.Owin.Infrastructure.OwinHelpers.SetHeaderUnmodified(IDictionary`2 headers,String key,String [] values)
at Microsoft.Owin.Infrastructure.OwinHelpers.AppendHeaderUnmodified(IDictionary`2 headers,String key,String [] values )
at Microsoft.Owin.HeaderDictionary.AppendValues(String key,String [] values)
at Microsoft.Owin.Infrastructure.ChunkingCookieManager.AppendResponseCookie(IOwinContext context,String key,String value,CookieOptions options)
at Microsoft.Owin.Security.Cookies.CookieAuthenticationHandler。< ApplyResponseGrantAsync> d__f.MoveNext( )
---抛出异常的前一个位置的堆栈跟踪结束--- System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
System.Runtime.CompilerServices上的
.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler。< ApplyResponseCoreAsync> d__b.MoveNext()
---从先前位置抛出异常的堆栈跟踪结束---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security。 Infrastructure.AuthenticationHandler。< ApplyResponseAsync> d__8.MoveNext()
---从抛出异常的先前位置开始的堆栈跟踪结束---
在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskAwaite r.HandleNonSuccessAndDebuggerNotification(任务任务)
at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler。< TeardownAsync> d__5.MoveNext()
---从抛出异常的上一个位置开始的堆栈跟踪结束 - -
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Security.Infrastructure .AuthenticationMiddleware`1。< Invoke> d__0.MoveNext()
---从抛出异常的上一个位置开始的堆栈跟踪结束---
在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
at Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2。< Invoke> d__0.MoveNext()
---从抛出异常的先前位置开始的堆栈跟踪结束---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2。 < Invoke> d__0.MoveNext()
---从抛出异常的上一个位置开始的堆栈跟踪结束--- System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess上的
(任务任务)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
at Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2。< Invoke> d__0.MoveNext()
--- End抛出异常的先前位置的堆栈跟踪--- System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess上的
(任务任务)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.Integr atedPipelineContextStage。< RunApp> d__5.MoveNext()
---从抛出异常的上一个位置开始的堆栈跟踪结束--- System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess上的
(任务任务)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext。< DoFinalWork> d__2.MoveNext()
- - 抛出异常的先前位置的堆栈跟踪结束--- Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)
at Microsoft.Owin.Host.SystemWeb
。在System.Web.HttpApplication.ExecuteStep的System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
中的IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar)
(IExecutionStep step,Boolean& ;已完成同步)
任何形式的帮助都将不胜感激。
谢谢你提前。
我尝试过的事情:
1。检查代码是否有错误
2.重新启动IIS
3.重新启动服务器(Windows Server 2012 R2)
4.升级OWIN但是OWIN Cookies 3.1不起作用,所以我将它再次降级为3.0.1
如果其他人面临类似的问题,这是解决方案。
Katana Project - Documentation [ ^ ]
Hello,
I have 2 applications running on IIS 8.5. Both of the applications need authentication. For the Authentication I used the Identity Data Model. When I run the applications from the debugger I have no problem login more than one user at the time.
When I take them to the IIS the applications don't allow more that one user at the time and they keep redirect users to login page (no error message). If I restart the IIS the applications allow multiusers for a while and then they don't.
I'm using .NET framework 4.5.2
I'm getting this warning on server's event viewer:
Exception information:
Exception type: HttpException
Exception message: Server cannot append header after HTTP headers have been sent.
at System.Web.HttpHeaderCollection.SetHeader(String name, String value, Boolean replace)
at System.Web.HttpHeaderCollection.Set(String name, String value)
at Microsoft.Owin.Host.SystemWeb.CallHeaders.AspNetResponseHeaders.Set(String key, String[] values)
at Microsoft.Owin.Host.SystemWeb.CallHeaders.AspNetResponseHeaders.set_Item(String key, String[] value)
at Microsoft.Owin.Infrastructure.OwinHelpers.SetHeaderUnmodified(IDictionary`2 headers, String key, String[] values)
at Microsoft.Owin.Infrastructure.OwinHelpers.AppendHeaderUnmodified(IDictionary`2 headers, String key, String[] values)
at Microsoft.Owin.HeaderDictionary.AppendValues(String key, String[] values)
at Microsoft.Owin.Infrastructure.ChunkingCookieManager.AppendResponseCookie(IOwinContext context, String key, String value, CookieOptions options)
at Microsoft.Owin.Security.Cookies.CookieAuthenticationHandler.<ApplyResponseGrantAsync>d__f.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 Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<ApplyResponseCoreAsync>d__b.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 Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<ApplyResponseAsync>d__8.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 Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<TeardownAsync>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 Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>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 Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.<Invoke>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 Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.<Invoke>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 Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.<Invoke>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 Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.<RunApp>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 Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.<DoFinalWork>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Any kind of help would be appreciated.
Thank you in advance.
What I have tried:
1. Checked the code for errors
2. Restarted IIS
3. Restarted the server (Windows Server 2012 R2)
4. Upgraded OWIN but OWIN Cookies 3.1 didn't work so I downgraded it again to 3.0.1
Here's the solution if someone else is facing similar issues.
Katana Project - Documentation[^]
这篇关于Asp.net不允许多个用户登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!