Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot use SQL server (LocalDB) after moving from IIS Express to Local IIS

When I run my website under local IIS instead of embedded IIS express I got the following error when accessing database (mdf file at app_data)

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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Here the connection string:

Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Sources\Local\WebApplication1\WebApplication1\App_Data\aspnet-WebApplication1-20140226022052.mdf;Integrated Security=True

From Visual Studio and IIS Express I could connect to that database:

https://db.tt/rBXiwyA5

But the issue is that I need to have access to deployed application from another computer and IIS Express doesn't allow remote connections. That is why I was forced to use Local IIS.

Thank you for any advises!

like image 508
Alexey Strakh Avatar asked Nov 11 '22 12:11

Alexey Strakh


1 Answers

you may need to double escape the \

"Data Source=(LocalDB)\v11.0;Integrated Security=true"

Unable to connect to localDB in VS2012 – "A network-related or instance-specific error occurred while establishing a connection to SQL Server..."

like image 142
user3418071 Avatar answered Dec 10 '22 03:12

user3418071