首页 > 代码库 > HttpContext.Current.Session[strName]未将对象引用设置到对象的实例
HttpContext.Current.Session[strName]未将对象引用设置到对象的实例
项目开发是在4.5.1上,不知道为啥客户提供的服务器上安装的是4.5,差别不大也没去升级,然后部署MVC的时候web.config报错
<system.web> <compilation debug="true" targetFramework="4.5.1"/> <httpRuntime targetFramework="4.5.1"/> </system.web>
然后也没在意就把这段给删掉了,然后Session那块就开始报错
HttpContext.Current.Session[Key.SessionOpenID] = openID;未将对象引用设置到对象的实例,因为用到了异步,所以一直报错,
最后在StackOverflow找到了原因
https://stackoverflow.com/questions/18383923/why-is-httpcontext-current-null-after-await
实在是蛋疼啊
警告:如果你的项目升级到4.5.一定要记得在webconfig里面加上这句话。
HttpContext.Current.Session[strName]未将对象引用设置到对象的实例
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。