首页 > 解决方案 > 即使删除 SessionState 代码,如何摆脱重复出现的 SessionState 错误“NullReferenceException”?

问题描述

我在 Visual Studio 2019 的 asmx Web 服务项目中对 SessionState 进行了试验。认为不值得麻烦,因此删除了我对用于测试的本地 IIS Web 服务器 web.config 所做的所有配置,并禁用了 ASP.NET services.msc 中的状态服务。但是现在,每当我在此 Visual Studio 项目中调试任何 Web 服务时,我都会在“Watch 1”选项卡中看到一个错误:

new System.Linq.SystemCore_EnumerableDebugView(Session.Contents.Keys).Items[0]  'new System.Linq.SystemCore_EnumerableDebugView(Session.Contents.Keys).Items[0]' threw an exception of type 'System.NullReferenceException' object {System.NullReferenceException}

代码没有中断,但我似乎无法阻止这个反复出现的 SessionState 错误的出现。将不胜感激任何帮助,谢谢

标签: visual-studioweb-servicessession-state

解决方案


推荐阅读