While trying to deploy a simple asp.net mvc project on an IIS 6 server, I keep getting this error "The provider requires SessionState to be enabled".
在尝试在IIS 6服务器上部署一个简单的asp.net mvc项目时,我不断收到此错误“提供程序需要启用SessionState”。
To rule out that I am doing something wrong, I am now trying to deploy just the template you get when you start a new asp.net mvc solution in vs2008. And yes, I have enabled session state in IIS config, also added the <sessionState mode="InProc" />
line to web.config, but that didn't make any difference.
为了排除我做错了什么,我现在正在尝试部署你在vs2008中启动新的asp.net mvc解决方案时获得的模板。是的,我在IIS配置中启用了会话状态,还将
Tried both the .mvc isapi mapping, as well as the wildcard mapping, and I still get the dreaded error message.
尝试了.mvc isapi映射,以及通配符映射,我仍然得到可怕的错误消息。
Am I overlooking something obvious ?
我忽略了一些明显的东西吗
3 个解决方案
#1
Check your web.config and check make sure that you don't have anything disabling session state. It would look like this.
检查您的web.config并检查确保您没有禁用会话状态的任何内容。它看起来像这样。
<sessionState mode="Off" />
Otherwise you may want to check and make sure you have session state enabled at the IIS level by...
否则,您可能需要检查并确保在IIS级别启用了会话状态...
- Click/select your site
- In the Application Settings area select Configuration and then Options tab.
- In the Application Configuration area select Enable Session State checkbox (or make sure it's checked).
点击/选择您的网站
在Application Settings区域中选择Configuration,然后选择Options选项卡。
在Application Configuration区域中,选择Enable Session State复选框(或确保选中它)。
#2
Not really an answer, but what I did was to add a new site to IIS, and let that run on port 81. It's for internal test / demo purpose, so that's not much of a problem.
这不是一个真正的答案,但我所做的是向IIS添加一个新站点,并让它在端口81上运行。它用于内部测试/演示目的,所以这不是什么大问题。
Then I set up a virtual directory as you can read from many guides out there, setup wildcard isapi rule to the .net 3.5 dll and the site was up right away.
然后我设置了一个虚拟目录,因为你可以从那里的许多指南中读取,设置通配符isapi规则到.net 3.5 dll并且该站点立即启动。
I now ran into the The provider requires SessionState to be enabled - error twice. On my testmachine at home and here at work, while deploying an mvc site to the default website in IIS 6, something must be going wrong, but can't tell you what...
我现在遇到了提供程序要求启用SessionState - 错误两次。在我家的测试机和工作中,在将mvc站点部署到IIS 6中的默认网站时,必定会出现问题,但无法告诉您什么......
And thanks Chad for trying to help me !
并感谢Chad试图帮助我!
#3
I had the same error, but in my case it had nothing to do with sessionstate (at least, it's not the source of the problem).
我有同样的错误,但在我的情况下,它与sessionstate无关(至少,它不是问题的根源)。
Have you set up error handling in your Global.asax file? If so, disable it for now.
您是否在Global.asax文件中设置了错误处理?如果是这样,请暂时禁用它。
protected void Application_Error(object sender, EventArgs e)
{
Exception exception = Server.GetLastError();
RouteData routeData = new RouteData();
routeData.Values.Add("controller", "ErrorController");
routeData.Values.Add("action", "HandleTheError");
routeData.Values.Add("error", exception);
Response.Clear();
Server.ClearError();
IController errorController = new ErrorController();
errorController.Execute(new RequestContext(
new HttpContextWrapper(Context), routeData));
}
After disabling this code I got an http 404 error that one of my pages could not be found. Don't forget to add the mvc extension to your links. If resolving the rootdirectory is your problem, use the function Url.Content in combination with "~/".
禁用此代码后,我收到一个http 404错误,无法找到我的某个页面。不要忘记将mvc扩展名添加到您的链接。如果您的问题是解析根目录,请将函数Url.Content与“〜/”结合使用。
#1
Check your web.config and check make sure that you don't have anything disabling session state. It would look like this.
检查您的web.config并检查确保您没有禁用会话状态的任何内容。它看起来像这样。
<sessionState mode="Off" />
Otherwise you may want to check and make sure you have session state enabled at the IIS level by...
否则,您可能需要检查并确保在IIS级别启用了会话状态...
- Click/select your site
- In the Application Settings area select Configuration and then Options tab.
- In the Application Configuration area select Enable Session State checkbox (or make sure it's checked).
点击/选择您的网站
在Application Settings区域中选择Configuration,然后选择Options选项卡。
在Application Configuration区域中,选择Enable Session State复选框(或确保选中它)。
#2
Not really an answer, but what I did was to add a new site to IIS, and let that run on port 81. It's for internal test / demo purpose, so that's not much of a problem.
这不是一个真正的答案,但我所做的是向IIS添加一个新站点,并让它在端口81上运行。它用于内部测试/演示目的,所以这不是什么大问题。
Then I set up a virtual directory as you can read from many guides out there, setup wildcard isapi rule to the .net 3.5 dll and the site was up right away.
然后我设置了一个虚拟目录,因为你可以从那里的许多指南中读取,设置通配符isapi规则到.net 3.5 dll并且该站点立即启动。
I now ran into the The provider requires SessionState to be enabled - error twice. On my testmachine at home and here at work, while deploying an mvc site to the default website in IIS 6, something must be going wrong, but can't tell you what...
我现在遇到了提供程序要求启用SessionState - 错误两次。在我家的测试机和工作中,在将mvc站点部署到IIS 6中的默认网站时,必定会出现问题,但无法告诉您什么......
And thanks Chad for trying to help me !
并感谢Chad试图帮助我!
#3
I had the same error, but in my case it had nothing to do with sessionstate (at least, it's not the source of the problem).
我有同样的错误,但在我的情况下,它与sessionstate无关(至少,它不是问题的根源)。
Have you set up error handling in your Global.asax file? If so, disable it for now.
您是否在Global.asax文件中设置了错误处理?如果是这样,请暂时禁用它。
protected void Application_Error(object sender, EventArgs e)
{
Exception exception = Server.GetLastError();
RouteData routeData = new RouteData();
routeData.Values.Add("controller", "ErrorController");
routeData.Values.Add("action", "HandleTheError");
routeData.Values.Add("error", exception);
Response.Clear();
Server.ClearError();
IController errorController = new ErrorController();
errorController.Execute(new RequestContext(
new HttpContextWrapper(Context), routeData));
}
After disabling this code I got an http 404 error that one of my pages could not be found. Don't forget to add the mvc extension to your links. If resolving the rootdirectory is your problem, use the function Url.Content in combination with "~/".
禁用此代码后,我收到一个http 404错误,无法找到我的某个页面。不要忘记将mvc扩展名添加到您的链接。如果您的问题是解析根目录,请将函数Url.Content与“〜/”结合使用。