静态内容和ASP.NET SQL会话(Static content and ASP.NET SQL sessions)

这是我的情景:

使用SQL Server会话(由于Web场) customErrors在使用重定向时打开 有一个成员资格提供程序,它使用会话来存储用户信息 在web.config中,有<location>部分<allow users="*"> 。 这用于静态内容(例如图像)

每当我尝试访问错误页面甚至静态内容时,会话都会尝试启动(可能是由于成员资格提供程序)。 如果SQL Server关闭,则抛出异常。

当我访问某些文件夹(即静态内容)时,有没有办法阻止成员资格提供者和/或会话尝试初始化?

Here's my scenario:

Using SQL Server sessions (due to web farm) customErrors is On using redirect There is a membership provider that uses sessions to store user information In web.config, there are <location> sections that <allow users="*">. This is used for static content (e.g. images)

Whenever I try to access the error page or even static content, the session tries to start up (probably due to membership provider). If the SQL Server is down, that throws an exception.

Is there any way to prevent the membership provider and/or sessions from trying to initialize when I'm accessing certain folders (i.e. static content)?

最满意答案

事实证明,我的大多数问题是由于IIS6,IIS7和开发服务器之间的差异:

http://www.asp.net/hosting/tutorials/core-differences-between-iis-and-the-asp-net-development-server-cs

IIS 6中 ,ASP.NET仅针对在“站点属性”>“虚拟目录”>“配置”>“映射”>“应用程序扩展”下配置的扩展运行。 例如,.aspx指向aspnet_isapi.dll。 默认情况下,静态内容不会通过ASP.NET。

IIS 7中 ,它类似(在Handler Mappings下),但是由于新的集成管道,在web.config中,您还可以使用静态内容检查进行身份验证。 请参阅上面的URL中的Performing Forms-Based Authentication and URL Authentication on Static Files with IIS 7 。

同样基于上面的URL,在ASP.NET Development Server中 (基于Cassini):

ASP.NET运行时处理进入ASP.NET开发服务器的每个请求,无论是ASP.NET页面,图像还是JavaScript文件。

It turns out most of my problem is because of differences between IIS6, IIS7, and the development server:

http://www.asp.net/hosting/tutorials/core-differences-between-iis-and-the-asp-net-development-server-cs

In IIS 6, ASP.NET only runs for extensions that are configured under Site properties > Virtual Directory > Configuration > Mappings > Application extensions. For example, .aspx points to aspnet_isapi.dll. Static content will not go through the ASP.NET by default.

In IIS 7, it's similar (under Handler Mappings), however thanks to the new integrated pipeline, in the web.config you can also have static content check for authentication. See Performing Forms-Based Authentication and URL Authentication on Static Files with IIS 7 in the URL above.

Also based on the above URL, in the ASP.NET Development Server (based on Cassini):

Every request that comes into the ASP.NET Development Server, whether for an ASP.NET page, an image, or a JavaScript file, is processed by the ASP.NET runtime.

更多推荐

SQL,会话,Server,sessions,web,电脑培训,计算机培训,IT培训"/> <meta name="de