0

I am trying to connect my asp.net web application with sql server but i am getting this error every time

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)

My SQL Server is also configured and allows remote connections and is running as well in the configuration Manager. Visual Studio throws an error of unrecognized symbol due to '\' in my server name (.\SQLExpress). I tried using different names of server like

server=DESKTOP-1MQQSA7\SQLExpress
server =.
server=SQLEXPRESS

but it is not working at all

Sql server running server name

Visual Studio showing the database name = desktop-1mqqsa7\sqlexpress

Configuration Manager image

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    you can add a "@" sign at the beginning of your connection string. – Farzad Karimi Jul 28 '18 at 12:56
  • The suggested "@" will avoid the need to escape the backslash. Your connection string should be @"Data Source=DESKTOP-1MQQSA7\SQLEXPRESS;Initial Catalog=master;Integrated Security=SSPI". I would have expected the SQL Server Browser service to be listed in SSCM, which is concerning. – Dan Guzman Jul 28 '18 at 13:00

0 Answers0