asp.net-core - 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 模块。添加额外的往返并可能影响性能。
解决方案
推荐阅读
- go - 尝试初始化 2D 切片,但元素引用更改了切片中的所有行
- regex - 匹配两个或多个不相同的字符
- java - 如何使用 Mockito 或 PowerMockito 在 JUnit 中模拟包含文件和 BufferedReader 的方法
- c# - 两个类库都需要相互引用
- python - 如何在 Django 中使用自定义模型扩展自用户模型?
- mongodb - 我想使用日期范围“utc_timestamp”字段从 mongodb 集合中获取结果?
- laravel - 调用未定义的方法 onlyTrashed()
- javascript - 在 Mechanical Turk (MTurk) 中设置 HTML 表单字段
- javascript - 从对象数组中调用另一个类的方法?
- javascript - 在 Chart.js 中显示 JSON