0

I really don't know how it is possible. Connection from my SQL Express to the online database and doing query/etc is it so fast.

But, running the web application on localhost to the online DB takes very long time. Such as 20-30 seconds for a simple request. Watching the website online is so fast. So there aren't problem with the main application.

Connection string such as :

<add key="ConnectionString_ONLINE" value="data source=95.40.100.200,1900;initial catalog=DBName;USER ID=Username;Password=Password;" />

What could be the main cause?

markzzz
  • 47,390
  • 120
  • 299
  • 507
  • 2
    Try enabling trace for your aspx page and see which component is taking longer time. – Rahul May 15 '12 at 10:56
  • Are you sure the connection to the remote server isn't slow itself? – Shimmy Weitzhandler May 15 '12 at 10:57
  • Yes! As I wrote, watching the website online it take only some ms... – markzzz May 15 '12 at 10:59
  • Maybe it is caused by the differences between the online and local hardware and on the SQL server edition. The query is executed on the Sql Server, I suggest to focus on the Sql Server not on the web site. Try to execute the same query (that causes the problem) directly to both Sql Servers. – chaliasos May 15 '12 at 11:56
  • Yeah, I've done it! the time is quite the same, in the order of ms! – markzzz May 15 '12 at 12:17
  • Please see this SO answer, as it may answer your question. http://stackoverflow.com/questions/250713/sqldataadapter-fill-method-slow/250961#250961 – HTTP 410 May 15 '12 at 15:54

1 Answers1

1

I realise this was asked quite some time ago, but for the sake of future searches I thought I'd add this...

I also had issues with a horribly slow connection on localhost SQL compared to a live SQL server box. Even over VPN it was quicker than my own localhost. I eventually realised that every time I was running the application on localhost, it was directly through Visual Studio which added it's own debugging overheads in some way. When I compiled the application and ran the EXE externally, I got faster speeds.

Just worth mentioning!

Simon
  • 8,981
  • 2
  • 26
  • 32