Results 1 to 6 of 6

Thread: Only one person at a time can see web site

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    589

    Only one person at a time can see web site

    I have a web site published to a Windows 2008 R2 server running IIS 7.5. The web site accesses a SQL 2008 database on a different server.

    The web site is accessed from an intranet.

    In global.aspx users are logged in by retrieving their Windows.Identity which is passed to a stored procedure that checks they have rights to access the system. All the people trying to access the system have rights to the system and if I run the stored procedure with their various Windows.Identities passed as the parameter - it returns that they are authorized.

    I have admin rights on the web server. If I browse the site from my box it works okay. If another user who has admin rights on the server browses the site (at the same time as me - or on their own) it works okay.

    If someone without admin rights to the server browses the site - and they are the only person 'on' the site - it works okay. If a second person tries to browse the site at the same time as the first person is logged in ... nothing happens. The progress bar in the browser just sits there forever. No errors etc.

    So, no-one using the site ... Fred types http://server1/system1/ into his browser and the site works okay.

    Jim types http://server1/system1/ into his browser and nothing happens.

    Fred logs off and Jim tries the site again. Works fine for Jim this time.

    Any ideas? I'm baffled.

    Thanks for any help.

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Only one person at a time can see web site

    Without seeing some of the code that you are using, it is going to be difficult to say. It sounds as though there is some sort of deadlock happening. Have you instrumented the site (i.e. added logging to the site)? It would be good to see at which point the bottle neck is happening.

    Gary

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    589

    Re: Only one person at a time can see web site

    Quote Originally Posted by gep13 View Post
    Without seeing some of the code that you are using, it is going to be difficult to say. It sounds as though there is some sort of deadlock happening. Have you instrumented the site (i.e. added logging to the site)? It would be good to see at which point the bottle neck is happening.

    Gary
    The code that does all the basic log in stuff is identical to the code on half a dozen systems already running. The only difference is that this is the first site developed in VS2010 - Framework 4.0 - and deployed on a server running IIS 7.5.

    All the other apps are on a Windows 2003 server running IIS 6. Logging ... every table in the database has an audit table which records every insert, update and delete - but I don't record each time a table is accessed.

    I can't see there being a lock in the database - when the site is accessed the only thing that runs is a stored procedure which comprises one select statement - it either returns some user data or it doesn't.

    I'm thinking this is some sort of permissions / authentication issue to do with IIS 7.5?

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    589

    Re: Only one person at a time can see web site

    I have a bit more information about this. It is nothing to do with whether a user has admin rights on the server or not. When others are using the site, I find I can't access it.

    So, I've ripped the site apart and taken it down to a one page site. I've moved the code that used to run in global.asax in Session_Start that logs users in to default.aspx.

    So, now, all that happens on default.aspx is this.

    Code:
    DataAccess da = new DataAccess();
            using (SqlDataReader dr = da.User_Login(CurrUser))
            {
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        Session["WPID"] = dr["WorkProgramID"];
                        Session["UserID"] = dr["UserID"];
                        Session["UserName"] = dr["Fullname"];
                        Session["GroupID"] = dr["GroupID"];
                        Session["GroupName"] = dr["GroupName"];
                    }
    
                }
                else
                {
                    Session["WPID"] = 0;
                    Session["UserID"] = 0;
                    Session["UserName"] = "";
                    Session["GroupID"] = 0;
                    Session["GroupName"] = "";
                }
    
                dr.Dispose();
            }
    If I publish that and access the site from a browser on my dev PC - it works fine. If I move to the PC on the desk next to me and try to access the site - maybe - sometimes - it will work. If I move to a 3rd PC and try to access the site in a browser - it most definitely does not work. It just hangs there.

    Before I stripped the site down to one page - obviously I kept the original site. If I publish that and log in - I can log in, and out, in and out, close the browser window, open it again, log in again - as many times as I like without a problem. When logged in I can use all the pages, over and over again, making dozens of database calls in the process.

    If I hard code some sessions in default.aspx instead of getting data from the database like:

    Code:
    string CurrUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString().Replace("\\", "/");
            Session["UserName"] = CurrUser;
            Session["WPID"] = "10";
            Session["UserID"] = "16";
            Session["UserName"] = "Jack Spratt";
            Session["GroupID"] = "26";
            Session["GroupName"] = "System";
    and publish the site - I can access the site from any number of PCs and it is fine. The minute I try to retrieve the user data from the database the problem manifests itself.

    At this point I am completely stymied. I copied the site back to another development box running VS2005 - and published it to another live server running Windows 2003 and it works perfectly.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    589

    Re: Only one person at a time can see web site

    I may have fixed it - the connection string in my web config file looked like this ...

    <add key="ConnectionString" value="server=*******;Trusted_Connection=YES;database=********;Integrated Security=true;Connect Timeout=0"/>

    I set the Connect Timeout to 15 and it seems to be working now.

    That connection string is identical to one used in about 6 apps published to a Windows Server 2003 running IIS 6. I can only assume some setting in IIS 6 on Windows 2003 was overriding the Connect Timeout of zero and setting it to some sensible figure. Whereas IIS 7.5 on Windows Server 2008 was taking the web config at its word and expecting the database connection to be made in 0 seconds. Oddly enough this seemed to be okay for the first two users of the site - after that it wouldn't work.

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Only one person at a time can see web site

    Hmmm, very weird!

    I have no explanation as to what could be going on here

    Sounds like you have a workaround though

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width