Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8223023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:31:25+00:00 2026-06-07T14:31:25+00:00

When I connect to SQL Azure from my ASP.NET MVC Application, I get the

  • 0

When I connect to SQL Azure from my ASP.NET MVC Application, I get the following error..

Exception Details: System.Data.SqlClient.SqlException: 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)

But, I am able to connect to SQL Azure from SQL Server Management Studio successfully. I also tried connecting using sqlCMD and that connects without any issue. Only issue arises is during runtime when I get this exception.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:31:28+00:00Added an answer on June 7, 2026 at 2:31 pm

    There must be something wrong with your connection string. You can’t connect to Windows Azure SQL Database (a.k.a. SQL Azure) via Named Pipes. The only supported protocol is TCP. So your conn string would look something like:

    Server=tcp:[servername].database.windows.net,1433;Database=[db_name];User
    ID=[username]@[servername];Password=[password];Trusted_Connection=False;Encrypt=True;Connection
    Timeout=30

    You can get connection string from the management portal. When you go to the database, you have the Connection string link at the right (new portal):

    SQL Azure show connection strings (new portal)

    And the old portal almost the same:

    SQL Azure Connection Strings old portal

    And finally, you must have enabled “Allow other Windows Azure Services to connect to this server” in the Firewall rules.

    **** UPDATE according to comments below ****

    And where is this connection string entry? IN web.config, or in web.release.config / web.debug.config. Note that web.config transformations will not work for while developing, only when packaging! Does this error occurs when you debug locally, or when you deploy?

    If locally, can you check which connection string are you actually using?

    Note that there is default “ApplicationServices” connection string (which is in apphost.config), which might take place when you try to “login/register” in the default MVC app! That connection string assumes local SQL Express instance is present and running. And this is default connection string for Memebership and Role providers. You will not be able to logn/register and whatever action that requires authentication, unless you change the Membership provider settings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want connect to SQL Server Compact 4.0 in my ASP.NET application. Here is
I want to deploy my ASP.NET application to MS Azure (and SQL Azure). The
I'm attempting to run the default Welcome to ASP.NET MVC! MVC3 application on Azure,
I'm developing an ASP.NET app (C#) that connect to SQL Server 2008 using ADO.NET
Until last week, I developed with SQL Server 2008 non-R2 and my ASP.NET MVC
I am using sqljdbc4.jar to connect SQL Server from my java application. I have
I want to connect SQL database from R.Net. I am using R.Net from vb.net.
I am trying to connect Sql Server Data Base using windows authentication from my
I am trying to connect SQL Server from a Windows service. Now my Windows
When I attempt to connect to SQL server using enterprise manager I get the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.