在 SharePoint 2010 中启用会话状态?
我有一个为 SharePoint 2007 构建的 Web 服务,我正在尝试将其移植到 SharePoint 2010。此 Web 服务依赖于会话状态才能正常运行,但到目前为止,我已经能够让会话状态在 SharePoint 2010 中正常工作该 Web 服务作为其自己的 Web 应用程序在 t 下运行。 /_vti_bin
虚拟目录。我已尝试以下所有方法,但没有成功:
- 确保“State Service”服务应用程序正在运行。
- 将
System.Web.SessionState.SessionStateModule
http 模块添加到我的应用程序的 web.config 文件中。 - 将
System.Web.SessionState.SessionStateModule
http 模块添加到我的 SharePoint 根 web.config 文件中。 - 将
添加到我的应用程序的 web.config 文件中。 - 将
添加到我的根 web.config 文件中。
其他环境信息:
- Visual Studio 2008 - SP1
- .NET 3.5 - SP1
- SharePoint 2010 - RC
- Windows Server 2008 R2
- ASMX Web 服务(不是 WCF)
有没有人有幸获得 Web 应用程序或 Web 服务来使用SharePoint 2010 中的会话状态还没有吗?
谢谢!
史蒂夫
I have a web service built for SharePoint 2007 that I am trying to port to SharePoint 2010. This web service is dependent on session state to function properly, but so far, I have been enable to get session state to work at all in SharePoint 2010. This web service runs as its own web application under t
he /_vti_bin
virtual directory. I have tried all of the following with no luck:
- Ensured the "State Service" service application is running.
- Added the
System.Web.SessionState.SessionStateModule
http module to my application's web.config file. - Added the
System.Web.SessionState.SessionStateModule
http module to my SharePoint root web.config file. - Added
<pages enableSessionState="true" />
to my application's web.config file. - Added
<pages enableSessionState="true" />
to my root web.config file.
Additional Environment info:
- Visual Studio 2008 - SP1
- .NET 3.5 - SP1
- SharePoint 2010 - RC
- Windows Server 2008 R2
- ASMX web service (not WCF)
Had anyone had any luck getting a web application or web service to use session state in SharePoint 2010 yet?
Thanks!
Steve
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您已经在互联网上的其他地方亲自回答过这个问题。 :)
然后,您必须进入您的 Web 应用程序并将相同的会话状态模块添加到 IIS7 托管管道中。
打开 IIS 7 管理器,找到您的 Web 应用程序。
双击 IIS 部分中的“模块”。
单击右侧窗格中的“添加托管模块...”。
在“添加托管模块”对话框中,输入
“SessionState”
或类似名称作为名称,然后从下拉列表中选择以下项目:<块引用>
System.Web.SessionState.SessionStateModule、System.Web、版本=2.0.0.0、文化=中性、PublicKeyToken=b03f5f7f11d50a3a
之后,应该为您的 Web 应用程序/Web 服务启用会话状态!
You've already answered this yourself somewhere else on the interweb. :)
THEN, you must go into your web application and add the same session state module to the IIS7 managed pipeline.
Open IIS 7 manager, and find your web application.
Double click "Modules" in the IIS section.
Click "Add Managed Module..." on the right hand pane.
In the Add Managed Module dialog, enter
"SessionState"
or something like that for the name, and choose the following item from the dropdown:After that, session state should be enabled for your web app/web service!
您可能需要打开会话状态服务。使用 PowerShell cmdlet Enable-SPSessionStateService。这将创建一个会话状态数据库并在 SharePoint 2010 中启动该服务。
参考信息:
http://technet.microsoft.com/en-us/library/ee890113.aspx
You may need to turn on the Session State Service. Use the PowerShell cmdlet Enable-SPSessionStateService. This will create a Session State database and start the service in SharePoint 2010.
Reference information:
http://technet.microsoft.com/en-us/library/ee890113.aspx
我见过的最好的链接在这里:http://blogs.msdn.com/b/markarend/archive/2010/05/27/using-session-state-in-sharepoint-2010.aspx
The best link I have seen on this is here: http://blogs.msdn.com/b/markarend/archive/2010/05/27/using-session-state-in-sharepoint-2010.aspx
Joshua 的解决方案帮助我指明了正确的方向,但我必须针对我的场景做出一些变化 - 部署到 _layouts 文件夹的 ASP.NET 3.5 网站。
以下是对我有用的步骤:
将网站 web.config 中的
标记更改为在 Sharepoint 网站级别(不是整个 IIS 级别)添加了 System.Web.SessionState.SessionStateModule 模块 - 这会破坏管理中心,我按照 @Joshua 的解决方案尝试了 :( )如果您要部署 Web 应用程序而不是网站,则需要在 Web 应用程序级别添加它。
将下面的 SessionState HTTPModule 添加到 web.config 似乎对我没有影响,可能是因为我使用的是 Sharepoint 的 web.config,因为我的项目是一个网站而不是 Web 应用 。对于这个问题还不是太清楚。
Joshua's solution helped point me in the right direction but I had to make some variations for my scenario - an ASP.NET 3.5 Web Site deployed to the _layouts folder.
Here are the steps that worked for me:
changed the
<pages>
tag in the web.config for the Web Site to<pages enableSessionState="true" />
Added the System.Web.SessionState.SessionStateModule module at the Sharepoint website level (not the entire IIS level - that'll break the Central Administration, I tried :( ) as per @Joshua's solution. If you're deploying a Web Application instead of a Web Site, you'll want to add it at your Web Application level.
Adding the SessionState HTTPModule below to the web.config didn't seem to have an effect for me, probably because I was riding on Sharepoint's web.config as my project was a Web Site and not a Web Application. Not too clear on this issue.
如下所示:
modules 是一个 xml 标签。我不知道为什么,这篇文章没有使用 xml 标签..
谢谢
卡罗尔
Do like below:
modules is an xml tag. I don't know why, this post is not taking xml tags..
Thanks
Carol