同时请求从同一浏览器超时

时间:2015-05-26 15:37:56

标签: asp.net sql-server reporting-services

我有一些奇怪的情况:如果我从IE启动非常缓慢的报告,随后从另一个选项卡通过asp.net应用程序向数据库发出更多请求 - 它们会超时,好像报告锁定了整个数据库。现在,如果我通过firefox启动报告 - 它仍然很慢,但通过IE发出的请求很好。如果交换浏览器也是如此 - 好像我无法启动报告并从同一浏览器中使用我的应用程序。我使用windows auth,sql server express,报告服务。任何线索都会受到赞赏。

修改 报告是从与主应用程序相同的IIS应用程序处理的,它只是一些Report.aspx页面。 此外,我已经通过探查器进行了检查 - 只要报告的请求处于活动状态,就没有新的数据库请求到达。一切都在同一台服务器上

EDIT1

  

并发请求和会话状态

     

对于每个会话,访问ASP.NET会话状态是独占的,这意味着   如果两个不同的用户发出并发请求,则访问每个用户   同时授予单独的会话。但是,如果两个并发   请求是针对同一会话进行的(使用相同的SessionID)   value),第一个请求获得对会话的独占访问权   信息。第二个请求仅在第一个请求之后执行   完了。 (如果排他性,第二次会议也可以访问   锁定信息被释放,因为第一个请求超过了   锁定超时。)如果@Page中的EnableSessionState值   指令设置为ReadOnly,即只读会话的​​请求   信息不会导致会话数据的独占锁定。   但是,会话数据的只读请求可能仍需要等待   对于由会话数据的读写请求设置的锁定来清除。

EDIT2 通过将此添加到web.config

解决了该问题
<appSettings>
<add key="ReportViewerServerConnection" value="AS.Web.Providers.ReportServerConnection, AS.Web.Common" />

<add key="MyReportServerUrl" value="http://reportserver/reportserver" />
<add key="MyReportViewerUser" value="user" />
<add key="MyReportViewerPassword" value="password" />
<add key="MyReportViewerDomain" value="domain" />-->
</appSettings>

应该在ssrs安全设置中添加用户(我已经使用了我的Windows登录)。 ReportServerConnection位于单独的库AS.Web.Common中:

public sealed class ReportServerConnection : IReportServerConnection2
{
    public WindowsIdentity ImpersonationUser
    {
        get
        {
            // Use the default Windows user.  Credentials will be
            // provided by the NetworkCredentials property.
            return null;
        }
    }

    public ICredentials NetworkCredentials
    {
        get
        {
            // Read the user information from the web.config file.  
            // By reading the information on demand instead of 
            // storing it, the credentials will not be stored in 
            // session, reducing the vulnerable surface area to the
            // web.config file, which can be secured with an ACL.

            // User name
            string userName =
                ConfigurationManager.AppSettings
                    ["MyReportViewerUser"];

            if (string.IsNullOrEmpty(userName))
                throw new Exception(
                    "Missing user name from Web.config file");

            // Password
            string password =
                ConfigurationManager.AppSettings
                    ["MyReportViewerPassword"];

            if (string.IsNullOrEmpty(password))
                throw new Exception(
                    "Missing password from Web.config file");

            // Domain
            string domain =
                ConfigurationManager.AppSettings
                    ["MyReportViewerDomain"];

            if (string.IsNullOrEmpty(domain))
                throw new Exception(
                    "Missing domain from Web.config file");

            return new NetworkCredential(userName, password, domain);
        }
    }

    public bool GetFormsCredentials(out Cookie authCookie,
                out string userName, out string password,
                out string authority)
    {
        authCookie = null;
        userName = null;
        password = null;
        authority = null;

        // Not using form credentials
        return false;
    }

    public Uri ReportServerUrl
    {
        get
        {
            string url =
                ConfigurationManager.AppSettings[
                    "MyReportServerUrl"];

            if (string.IsNullOrEmpty(url))
                throw new Exception(
                    "Missing url from the Web.config file");

            return new Uri(url);
        }
    }

    public int Timeout
    {
        get
        {
            return 60000; // 60 seconds
        }
    }

    public IEnumerable<Cookie> Cookies
    {
        get
        {
            // No custom cookies
            return null;
        }
    }

    public IEnumerable<string> Headers
    {
        get
        {
            // No custom headers
            return null;
        }
    }
}

类似文章:here

1 个答案:

答案 0 :(得分:1)

您可能遇到会话状态问题: http://odetocode.com/Blogs/scott/archive/2006/05/21/session-state-uses-a-reader-writer-lock.aspx

使用两种不同的浏览器时,您没有遇到此问题,因为它们运行的​​是两个不同的会话cookie。

相关问题