I am having problems creating a Service Based Database on Visual Studio 2013 Community.
Basically, the problem is that when I attempt to add a Service Based Database to any of my projects I get an error message:
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: 50 - Local Database Runtime error occurred.
Cannot create an automatic instance. See the Windows Application event
log for error details)
In the past I have been able to add Databases to my projects without any issues. What has changed between now and then is that I started using SQL Server 2014 to work with a Java Project. I assume that installing SQL Server 2014 has changed some configuration settings that are now preventing me from creating a local database in Visual Studio.
I was able to resolve this by changing the name of the server (as configured in Visual Studio through Tools>Options>Database Tools>Data Connections) to SQLEXPRESS and was able to create a database, however, when I went to create a data source from the database, I got to the final step before I got the message:
Could not load file or assembly
'Microsoft.SqlServer.Management.Sdk.Sfc, Version=11.0.0.0,
Culture=neutral, PublicKeyToken or one of its dependencies. The system
cannot find the file specified
After downloading some files and installing them I saw no effects. I really still want to use a local database, and after trying to return back to using a local database I can't get anything at all to work. Now, no matter what I try I get the error message:
A network-related or instance-specific error occured while
establishing a connection to SQL Server. The server was not found or
wa 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)
If I want to work with local databases in Visual Studio, can I do this with SQL Server 2014 installed? If so, is there anywhere that I am going wrong?
Thank you very much for any help you can provide.
Ok so I managed to fix my problem.
To create a local database I had to use the SQL Server Instance name (localDB)\v11.0 and install 2012 LocalDB. It would appear as though installing SQL Server 2014 updated the 2012 version of LocalDB to a 2014 version, which Visual Studio 2013 is not compatible with.
I would thank everyone for the help, but there is no-one to thank.
Try running Visual Studio 2013 as administrator. It worked for me.
I found here ( A network-related or instance-specific error occurred while establishing a connection to SQL Server ) that the error is related with rights accessing databases.
Related
I have created a C# project using VS 2019 which connects to LocalDb.
Any machine which has 64 bit, I install SQL Server 2016 LocalDb before running my project and after that it works fine.
Now some machines are using 32 bit operating system, so I installed SQL Server 2012 Express LocalDB.
But my project is not working and I get this error:
System.Data.SqlClient.SqlException: "A network or specific instance error occurred while establishing a connection to SQL Server. The server could not be found or is unavailable. Make sure the instance name is correct and that remote connections are allowed on SQL Server. (Provider : SQL Network Interfaces, error: 50 - A Local Database Runtime error occurred. An unexpected error occurred while calling the LocalDB instance API method. For more information about the error, see the Windows Application Event Log.
This is my connection string:
Server=(LocalDB)\MSSQLLocalDB;Integrated Security=true;AttachDbFileName=D:\Data\TestDB.mdf
Any help would be appreciated.
Thanks
During development on my local computer, I am able to connect to the remote (Production) SQL Server with no issues, but when I deploy the application to said production server, I get this error:
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: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.
I have done I believe all the things suggested to resolve this problem with no success. Please help if you can. Thanks!
I figured out the answer to my issue. I am using ASP.NET Identity and it created it's own connection but I wanted to use my own database. When I deployed my application that connection was broken. Changed the Identity connection to my own database connection and all worked as expected.
For the life of me I am unable to connect to my localdb hosted database created in Visual Studio 2015 to my local IIS 7 instance running on the same machine. IIS Express works fine but when I wanted to test things as a user outside of my network I dabbled with a Local copy of IIS.
I have tried everything from ensuring the app pools have the right privileges, that my connection strings are accurate and just about every thing else I have found on the web but I cannot for the life of me get this working.
The error I am getting is the following: 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: 50 - Local Database Runtime error occurred. Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user.
)
Connection String in VS2015:
Any other details needed to help troubleshoot ask and I will provide.
Thank you in advance for reading.
I'm following [this tutorial], I'm trying to create EF database in C# console application, but (even if I do exactly everything as in tutorial) it fails on
db.Blogs.Add(blog);
db.SaveChanges();
lines. Error:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.dll. Additional information: 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: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)
As author of tutorial says, it shouldn't require me to do anything to configure my DB, but it seems like it does.
What should I do to make it work?
Software that I use:
Visual Studio 2015, EntityFramework 6.1.3.
In Visual Studio 2015 the built in SQL database the comes with it is mssqllocaldb and not SQL Express.
This can be accessed with:
(localdb)\MSSQLLocalDB
rather than
.\sqlexpress
In the tutorial under the section after "You can connect to this database using Server Explorer in Visual Studio" follow the instructions to connect to a database and replace .\sqlexpress with (localdb)\MSSQLocalDB if you can connect this database then change your connection string in your application.
The solution that worked for me is:
Open Visual Studio installer (*.exe file used to install Visual Studio)
Click on "Modify" button
Find "Microsoft SQL Server Data Tools" and check it
Click "Update"
Now your database should work.
I am developing an application that contains a small SQL Server database File.
On my machine, it works fine. I am using Microsoft Visual C# Express 2010.
I have sent my project to a colleague. He is using the same software. And he has placed the database file in the same place (c:\folder\db.mdf). However, he gets the following error when trying to open the connection:
System.Data.SqlClient.SqlException was unhandled
Message=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)
How can I help my colleague get connected? He is on the other side of the country.
There are several ways to copy a database from one machine to another - the way I normally do it is to use SQL Server management studio to do a backup on the "from" and then to do a restore on the "to".
For more information, check out questions/answers like:
Copy SQL Server Express Database to Another Computer
SQL Server 2005: how to copy database from one server to another (manually/programmatically)
Easiest way to copy an entire SQL server Database from a server to local SQL Express
Programmatically detach SQL Server database to copy mdf file