首页 > 解决方案 > ASP.NET Core (!) 应用程序中出现奇怪的 .NET Framework (!) 错误

问题描述

我在 IIS模式下运行 ASP.NET Core应用程序(不是旧的 .NET Framework,这很重要) 。inprocess

在检查了事件日志后,我发现了这个不时发生的错误:

Account name: IIS APPPOOL\MyAppPool
Exception information:
    Exception type: HttpException
    Exception message: Cannot redirect after HTTP headers have been sent.
   at System.Web.HttpResponse.Redirect(String url, Boolean endResponse, Boolean permanent)
   at System.Web.Security.FormsAuthenticationModule.OnLeave(Object source, EventArgs eventArgs)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

错误本身并不是很重要。

重要的是调用堆栈中有.NET Framework 的内容。这是一个.NET Core 应用程序,里面怎么会有Framework?

这是否意味着“经典”的 ASP.NET 4.x 模块仍然存在于 IIS 模块中的某个地方,并且它会为(某些)请求启动?

PS 我的假设是这样的:一些老用户不断向服务器发送一个旧的“表单身份验证”cookie(我们最近将此应用程序迁移到 NET-Core,有些用户可能很久以前在他们的浏览器中仍然有那个 cookie)这使得“老” ASP.NET 开始了。你怎么看?

更新:将应用程序池从“NET CLR 4”切换到“无托管代码”后,错误似乎已经停止。这意味着这个设置有点重要。除非它设置为“无托管代码”,否则所有 http 请求仍将通过旧的 ASP.NET IIS 模块。添加额外的往返并可能影响性能。

标签: asp.net-coreiis.net-core

解决方案


推荐阅读