【问题标题】:Session state can only be used when enableSessionState is set to true, either in a configuration . i use enableSessionstate true in web config会话状态只能在 enableSessionState 设置为 true 时使用,无论是在配置中。我在网络配置中使用 enableSessionstate true
【发布时间】:2021-05-13 18:30:11
【问题描述】:

只有在 enableSessionState 设置为 true 时才能使用会话状态,无论是在配置文件中还是在 Page 指令中。还请确保 System.Web.SessionStateModule 或自定义会话状态模块包含在应用程序配置的 部分中。 ,我想在本地局域网中部署项目,在 IIS 中。我关注所有事情,但这个错误没有解决。

我在网络配置中添加了以下代码,但不起作用。

   <system.web>
      <pages enableSessionState="true" /> 
 </system.web>

enter image description here

【问题讨论】:

  • 您的问题解决了吗?如果您的问题得到解决,那么我请求您将有用的建议标记为答案。这将帮助面临同样问题的其他人。

标签: sql asp.net iis


【解决方案1】:

您尝试以下解决方法来解决问题:

1.在您的 web.config 中删除并重新添加:

<configuration>
  <system.webServer>
    <modules>
      <remove name="Session" />
      <add name="Session" type="System.Web.SessionState.SessionStateModule"/>
    </modules>
  </system.webServer>
</configuration>

2.在 web.config 的元素中设置 runAllManagedModulesForAllRequests="true"

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true" />
</system.webServer>

3.运行以下PowerShell命令:

Enable-SPSessionStateService –DefaultProvision

【讨论】:

    猜你喜欢
    • 2012-10-27
    • 2012-12-29
    • 2013-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-04
    • 2012-07-04
    • 1970-01-01
    相关资源
    最近更新 更多