0

I am very new with Azure. I created Azure virtual machine that hosts SQL Server 2008.

My application use ASP.NET MVC 4 and hosted on Amazon Web Service. The application works well and I can connect to database with Management Studio. However, I now get this error sometime.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) 

I don't know how to solve this problem. Do I need to implement retry connection to database as SQL Azure, I now use the traditional connection string and NHibernate, connect SQL Server with domain name (abc.cloudapp.net) or there is another issues to consider if we use SQL Server 2008 on Azure Virtual Machine.

As @SqlACID's comment, this is my current connection string. Server=domain.cloudapp.net;Database=db;User ID=uid;Password=pwd; where I change the real value to domain, db and pwd for security reason.

However, this happens sometime three times yesterday.

Thank you so much.

embarus
  • 815
  • 3
  • 14
  • 28

1 Answers1

0

There may be Problem with connection to SQL Server.

It can be

  1. The DB is offline.
  2. The connection string used is not valid (Username or Password mismatch).
  3. The Instance DB name is incorrect. (Spell mistake)

Please check your web.config file.

A very Good link of Possible errors with answers.

More error list here

MSDN Similar Question

Stack similar Question

Community
  • 1
  • 1
Prahalad Gaggar
  • 11,389
  • 16
  • 53
  • 71
  • Thank you so much @Luv for fast reply. I think username and password is correct because I can connect to database and it is working now. However sometime I got the error. – embarus Jul 16 '13 at 08:12