0

I have developed an images and video blogging website using asp.net 4.0 & sql server 2008. Everything was going well, but now I am facing Error 503 when a large number of users visit concurrently. My website is on a Shared Hosting (GoDaddy). What I have tried till now is:

1.using using Statements (i.e my connection disconnects after each query):

            using (SqlConnection conn = new SqlConnection(constrg))
            {
                DataTable dt = new DataTable();
                using (SqlCommand cmd = new SqlCommand(cmdText, conn))
                {
                    cmd.CommandType = Type;
                    if (prms != null)
                    {
                        foreach (SqlParameter p in prms)
                        {
                            cmd.Parameters.Add(p);
                        }
                    }
                    SqlDataAdapter adpt = new SqlDataAdapter(cmd);
                    adpt.Fill(dt);
                    return dt;
                }
            }

2.set NoCount for sql procedures

But still I am facing the same problem. Now my questions are:

How can I get rid of this problem ?

Can it be solved by changing my hosting?

Is it something that I am missing in my code ?

Should i implement Caching? & How?

Shaminder Singh
  • 1,283
  • 2
  • 18
  • 31
  • Shared hosting on Go-Daddy means no more than 25 users simultaneously! You should ask them what can be done. I experienced the same with 1&1 which is even worst (15 simultaneous connections). – FeliceM Jul 12 '14 at 14:33
  • changing the hosting is only option left ? or can i improve my code as well ? – Shaminder Singh Jul 12 '14 at 14:45
  • Hundreds, Thousands or Millions users? Which are the performance of your website (cpu/memory). http://msdn.microsoft.com/en-us/library/ff647813.aspx However, looks lil eyou have problems in connecting with the database not a problem on IIS. – FeliceM Jul 12 '14 at 14:53
  • yes, i too think that its problem with SQL, I have around 4k to 5k users concurrently hitting the same link i share. – Shaminder Singh Jul 12 '14 at 15:00
  • You really need to get more detail on _why_. `503` isn't enough because all it really says is "unavailable" (not why). I don't know if you have access to your logs. If unsolved, you risk propagating it to whatever level of hosting. e.g. **if** SQL: `Exception: System.InvalidOperationException Message: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool..because all pooled connections were in use and max pool size was reached.` Hth. – EdSF Jul 12 '14 at 15:12
  • unfortunately i don't have the access to the logs, i will try contacting godaddy for providing me the error logs, then will came here again. – Shaminder Singh Jul 12 '14 at 15:18
  • 1
    @ShaminderSingh you need to configure error reporting anyway. How else are you going to find out about bugs? Maybe use ELMAH. – usr Jul 12 '14 at 15:22
  • @usr i have successfully added elmah on my local machine, and is working fine. iam accessing it using /elmah.axd. But its not working online on Godaddy. i am getting an error 500. i have made some changes accordingly but in vain. – Shaminder Singh Jul 12 '14 at 16:48
  • Why do you believe this is a database issue? Are you getting database exceptions, or are queries running slowly? – Dan Guzman Jul 12 '14 at 21:25

0 Answers0