Not able to resolve EnableSessionState is set to true 错误在所有 DNN 页面中

Not able to resolve EnableSessionState is set to true error in all DNN pages

我已经在 Google 中研究过这个错误,但没有成功,最后发布在这里。

我已经下载了我的实时网站、数据库并将其集成到我的本地环境中。我只能看到主页,但看不到其他页面。我在所有其他页面中都遇到以下错误。

我认为 default.aspx 是 DNN 中的主页,因此它工作正常,但不是从 DNN tables 动态呈现的其他页面。

错误异常:

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \ section in the application configuration.

事件日志Table消息:

DotNetNuke.Services.Exceptions.PageLoadException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration. ---> System.Web.HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration. at System.Web.UI.Page.get_Session() at DotNetNuke.Framework.CachePageStatePersister.Save() at System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) at System.Web.UI.Page.SaveAllState() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---

我参考了 this link 并在我的网络配置文件中进行了如下更新,但我错过了我网站的所有页面,也看不到主页。 EventLog table 向我显示与我在问题中发布的相同的错误消息。

像下面这样更新网络配置:

<modules runAllManagedModulesForAllRequests="true">
  <remove name="Session" />
  <add name="Session" type="System.Web.SessionState.SessionStateModule"/>      

...

 <httpModules>
  <add name="Session" type="System.Web.SessionState.SessionStateModule"  />

...

<pages validateRequest="false" enableViewStateMac="true" enableEventValidation="false" viewStateEncryptionMode="Always" enableSessionState="true" >

错误之前:

我已将我的 DNN 网站添加为本地 IIS 服务器中的子目录,因此我的访问权限 URL 已变为 http://localhost/WebsiteName/。由于 DNN 核心库中的某些原因,它不能与子目录一起使用,并且在我的本地计算机中遇到错误 enableSessionState is set to true, either in a configuration file or in the Page directive 但在实时情况下,它在 IIS 服务器上安装为 Default Web Site

错误已解决:

只需将我的网站从子目录替换到 IIS 服务器中的 Default Web Site 即可。我没有收到任何错误。所以,现在访问 URL 变成 http://localhost/

我检查了设置在同一个应用程序池和同一个 dotnet 框架版本中的两个网站,但是子目录网站不起作用,当我将它设置为默认 IIS 网站时它起作用了。

此post的访问者:

如果您无法解决此错误,可以使用 Cathal Connoly(DNN MVP)的回答。请参阅此 link 了解更多信息。

看来,如果您更改页面状态持久性,这将解决它 (http://www.dnnsoftware.com/Content/Dn...),或者在您的 web.config

中启用 set enableSessionState to true