To begin — there are 4 issues that could be causing the common LocalDb SqlExpress Sql Server connectivity errors SQL Network Interfaces, error: 50 - Local Database Runtime error occurred
, before you begin you need to rename the v11 or v12 to (localdb)mssqllocaldb
Possible Issues
- You don’t have the services running
- You don’t have the firelwall ports here
configured - Your install has and issue/corrupt (the steps below help give you a nice clean start)
- You did not rename the V11 or 12 to mssqllocaldb
\ rename the conn string from v12.0 to MSSQLLocalDB -like so-> `<connectionStrings> <add name="ProductsContext" connectionString="Data Source= (localdb)mssqllocaldb; ...`
I found that the simplest is to do the below — I have attached the pics and steps for help.
First verify which instance you have installed
, you can do this by checking the registry& by running cmd
1. `cmd> Sqllocaldb.exe i`
2. `cmd> Sqllocaldb.exe s "whicheverVersionYouWantFromListBefore"`
if this step fails, you can delete with option `d` cmd> Sqllocaldb.exe d "someDb"
3. `cmd> Sqllocaldb.exe c "createSomeNewDbIfyouWantDb"`
4. `cmd> Sqllocaldb.exe start "createSomeNewDbIfyouWantDb"`
ADVANCED Trouble Shooting
Registry
configurations
Edit 1, from requests & comments: Here are the Registry path for all versions, in a generic format to track down the registry
Paths
// SQL SERVER RECENT VERSIONS
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server(instance-name)
// OLD SQL SERVER
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesMSSQLServer
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServer
// SQL SERVER 6.0 and above.
HKEY_LOCAL_MACHINESystemCurrentControlSetServicesMSDTC
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSQLExecutive
// SQL SERVER 7.0 and above
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSQLServerAgent
HKEY_LOCAL_MACHINESoftwareMicrosoftMicrosoft SQL Server 7
HKEY_LOCAL_MACHINESoftwareMicrosoftMSSQLServ65
Searching
SELECT registry_key, value_name, value_data
FROM sys.dm_server_registry
WHERE registry_key LIKE N'%SQLAgent%';
or Run this in SSMS Sql Management Studio, it will give a full list of all installs you have on the server
DECLARE @SQL VARCHAR(MAX)
SET @SQL = 'DECLARE @returnValue NVARCHAR(100)'
SELECT @SQL = @SQL + CHAR(13) + 'EXEC master.dbo.xp_regread
@rootkey = N''HKEY_LOCAL_MACHINE'',
@key = N''SOFTWAREMicrosoftMicrosoft SQL Server' + RegPath + 'MSSQLServer'',
@value_name = N''DefaultData'',
@value = @returnValue OUTPUT;
UPDATE #tempInstanceNames SET DefaultDataPath = @returnValue WHERE RegPath = ''' + RegPath + '''' + CHAR(13) FROM #tempInstanceNames
-- now, with these results, you can search the reg for the values inside reg
EXEC (@SQL)
SELECT InstanceName, RegPath, DefaultDataPath
FROM #tempInstanceNames
Trouble Shooting
Network
configurations
SELECT registry_key, value_name, value_data
FROM sys.dm_server_registry
WHERE registry_key LIKE N'%SuperSocketNetLib%';
- Remove From My Forums
SQL Network Interfaces, error: 50 — Local Database Runtime error occurred
-
Question
-
I installed the new version of SQL but I am still getting this same error :
//Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
//string temp = @"Data Source=MOXL0063TEW_SQLEXPRESS; Integrated Security = True"; string temp = @"Data Source=(LocalDB)v11.0;AttachDbFilename='C:App_DataWrestling.mdf';Integrated Security=True"; // string temp = @"Data Source=(LocalDB)MSSQLSERVER;AttachDbFilename='C:App_DataWrestling.mdf';Integrated Security=True";
but nothing is working… why?
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 a service that can pull data from a
(LocalDB)MSSQLLocalDB
database.
This works fine on my computer, but then I run the service on my AWS server and it does not work
- Remove From My Forums
-
Question
-
From Robert Luongo @RobertLuongo via Twitter
I got stuck at the point when you need to run the update-database command on the NuGet Package Console. I have followed all exact instructions, and the default connection string that has been created is as follows. <add name=»DefaultConnection»
connectionString=»Data Source=(LocalDb)MSSQLLocalDB;AttachDbFilename=|DataDirectory|aspnet-ContactManager-20160302022257.mdf;Initial Catalog=aspnet-ContactManager-20160302022257;Integrated Security=True» providerName=»System.Data.SqlClient»
/>.When I run the update-database command I get the following 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: 50 — Local Database Runtime error occurred. The specified LocalDB instance does not exist. Using NuGet Package Manager 3.3.0 with Visual Studio 2015 Community
Version 14.0.24720.00.EDIT: This is now sorted !!
Issue was as you anticipated the NuGet Package Manager was not able to create the instance specified in the DefaultConnection string. Data Source=(LocalDb)MSSQLLocalDB. I changed it to Data Source=(LocalDB)v11.0 and it now works, probably this is how the
instance should be specified when using SQL Express Edition ??Thanks,
@AzureSupport
Thiene Schmidt
-
Edited by
Thursday, March 3, 2016 11:33 AM
-
Edited by
Answers
-
Yes SQL Express Edition will throw an instance specific error when using Data Source=(LocalDb)MSSQLLocalDB
in connection string, the only way I got it to work was by changing it to (LocalDB)v11.0 , so is that
actually an SQL Express Edition issue ??? or is it caused by something else ?? thanks !!-
Proposed as answer by
Casey KarstMicrosoft employee
Friday, March 4, 2016 11:52 PM -
Marked as answer by
Casey KarstMicrosoft employee
Monday, March 7, 2016 3:54 PM
-
Proposed as answer by
score:127
Accepted answer
Breaking Changes to LocalDB: Applies to SQL 2014; take a look over this article and try to use (localdb)mssqllocaldb
as server name to connect to the LocalDB automatic instance, for example:
<connectionStrings>
<add name="ProductsContext" connectionString="Data Source=(localdb)mssqllocaldb;
...
The article also mentions the use of 2012 SSMS to connect to the 2014 LocalDB. Which leads me to believe that you might have multiple versions of SQL installed — which leads me to point out this SO answer that suggests changing the default name of your LocalDB «instance» to avoid other version mismatch issues that might arise going forward; mentioned not as source of issue, but to raise awareness of potential clashes that multiple SQL version installed on a single dev machine might lead to … and something to get in the habit of in order to avoid some.
Another thing worth mentioning — if you’ve gotten your instance in an unusable state due to tinkering with it to try and fix this problem, then it might be worth starting over — uninstall, reinstall — then try using the mssqllocaldb
value instead of v12.0
and see if that corrects your issue.
score:1
My issue was that i had multiple versions of MS SQL express installed. I went to installation folder C:/ProgramFiles/MicrosoftSQL Server/ where i found
3 versions of it. I deleted 2 folders, and left only MSSQL13.SQLEXPRESS which solved the problem.
score:2
In my case, we had several projects in one solution and had selected a different start project than in the package manager console when running the «Update-Database» Command with Code-First Migrations.
Make sure to select the proper start project.
score:2
I have solved above problem Applying below steps
And after you made thses changes, do following changes in your web.config
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)v12.0;AttachDbFilename=|DataDirectory|aspnet-Real-Time-Commenting-20170927122714.mdf;Initial Catalog=aspnet-Real-Time-Commenting-20170927122714;Integrated Security=true" providerName="System.Data.SqlClient" />
score:3
All PLEASE note what Tyler said
Note that if you want to edit this file make sure you use a 64 bit text editor like notepad. If you use a 32 bit one like Notepad++ it will automatically edit a different copy of the file in SysWOW64 instead. Hours of my life I won’t get back
score:4
Final Solution for this problem is below :
-
First make changes in applicationHost config file. replace below string setProfileEnvironment=»false» TO setProfileEnvironment=»true»
-
In your database connection string add below attribute : Integrated Security = SSPI
score:4
I ran into the same problem. My fix was changing
<parameter value="v12.0" />
to
<parameter value="mssqllocaldb" />
into the «app.config» file.
score:8
maybe this error came because this version
of Sql Server is not installed
connectionString="Data Source=(LocalDB)v12.0;....
and you don’t have to install it
the fastest fix is to change it to any installed version you have
in my case I change it from v12.0
to MSSQLLocalDB
score:18
An instance might be corrupted or not updated properly.
Try these Commands:
C:>sqllocaldb stop MSSQLLocalDB
LocalDB instance "MSSQLLocalDB" stopped.
C:>sqllocaldb delete MSSQLLocalDB
LocalDB instance "MSSQLLocalDB" deleted.
C:>sqllocaldb create MSSQLLocalDB
LocalDB instance "MSSQLLocalDB" created with version 13.0.1601.5.
C:>sqllocaldb start MSSQLLocalDB
LocalDB instance "MSSQLLocalDB" started.
score:25
To begin — there are 4 issues that could be causing the common LocalDb SqlExpress Sql Server connectivity errors SQL Network Interfaces, error: 50 - Local Database Runtime error occurred
, before you begin you need to rename the v11 or v12 to (localdb)mssqllocaldb
Possible Issues
- You don’t have the services running
- You don’t have the firelwall ports here
configured - Your install has and issue/corrupt (the steps below help give you a nice clean start)
- You did not rename the V11 or 12 to mssqllocaldb
\ rename the conn string from v12.0 to MSSQLLocalDB -like so-> `<connectionStrings> <add name="ProductsContext" connectionString="Data Source= (localdb)mssqllocaldb; ...`
I found that the simplest is to do the below — I have attached the pics and steps for help.
First verify which instance you have installed
, you can do this by checking the registry& by running cmd
1. `cmd> Sqllocaldb.exe i`
2. `cmd> Sqllocaldb.exe s "whicheverVersionYouWantFromListBefore"`
if this step fails, you can delete with option `d` cmd> Sqllocaldb.exe d "someDb"
3. `cmd> Sqllocaldb.exe c "createSomeNewDbIfyouWantDb"`
4. `cmd> Sqllocaldb.exe start "createSomeNewDbIfyouWantDb"`
ADVANCED Trouble Shooting
Registry
configurations
Edit 1, from requests & comments: Here are the Registry path for all versions, in a generic format to track down the registry
Paths
// SQL SERVER RECENT VERSIONS
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server(instance-name)
// OLD SQL SERVER
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesMSSQLServer
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServer
// SQL SERVER 6.0 and above.
HKEY_LOCAL_MACHINESystemCurrentControlSetServicesMSDTC
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSQLExecutive
// SQL SERVER 7.0 and above
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSQLServerAgent
HKEY_LOCAL_MACHINESoftwareMicrosoftMicrosoft SQL Server 7
HKEY_LOCAL_MACHINESoftwareMicrosoftMSSQLServ65
Searching
SELECT registry_key, value_name, value_data
FROM sys.dm_server_registry
WHERE registry_key LIKE N'%SQLAgent%';
or Run this in SSMS Sql Management Studio, it will give a full list of all installs you have on the server
DECLARE @SQL VARCHAR(MAX)
SET @SQL = 'DECLARE @returnValue NVARCHAR(100)'
SELECT @SQL = @SQL + CHAR(13) + 'EXEC master.dbo.xp_regread
@rootkey = N''HKEY_LOCAL_MACHINE'',
@key = N''SOFTWAREMicrosoftMicrosoft SQL Server' + RegPath + 'MSSQLServer'',
@value_name = N''DefaultData'',
@value = @returnValue OUTPUT;
UPDATE #tempInstanceNames SET DefaultDataPath = @returnValue WHERE RegPath = ''' + RegPath + '''' + CHAR(13) FROM #tempInstanceNames
-- now, with these results, you can search the reg for the values inside reg
EXEC (@SQL)
SELECT InstanceName, RegPath, DefaultDataPath
FROM #tempInstanceNames
Trouble Shooting
Network
configurations
SELECT registry_key, value_name, value_data
FROM sys.dm_server_registry
WHERE registry_key LIKE N'%SuperSocketNetLib%';
score:36
I usually fix this errore following this msdn blog post Using LocalDB with Full IIS
This requires editing applicationHost.config file which is usually located in C:WindowsSystem32inetsrvconfig. Following the instructions from KB 2547655 we should enable both flags for Application Pool ASP.NET v4.0, like this:
<add name="ASP.NET v4.0" autoStart="true" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
</add>
score:42
Running this:
sqllocaldb create «v12.0»
From cmd prompt solved this for me…
Related Query
- Why am I getting this database connectivity error in SQL Server?
- C# local database update error
- Error when trying to insert data to a SQL Server database through a C# application
- C# connection to SQL database error
- I´m trying to make a login from a sql database but keep getting this error
- Error when restoring SQL Server database from C#
- Connecting to local SQL Server CE database issue?
- Saving records into database throws runtime error in ASP.Net C#
- Azure SQL database backup to local server in weekly automatically
- Connect to a SQL Server database on another network via asp.net and c#
- SQL database creation error while executing «ExecuteNonQuery» in C#
- What is the best local sql database for a .net client application?
- Entity Framework returns empty data for a local database that shows data in SQL Server Object Explorer
- Error with adding records to SQL Server database (nvarchar)
- «A non-recoverable error occurred during a database lookup» on Windows 7 with KB4103718 in Dns.GetHostAddresses()
- Even after i specify login credentials in a connection string, users are still getting an error that their user cannot access a database
- Cannot copy database from solution to local package folder on UWP
- Local SQL Server database in Visual Studio 2017 C# (‘Incorrect syntax near the keyword ‘FROM»)
- An arithmetic overflow error occurred while converting varchar to numeric data type in SQL Server 2008
- Error connecting to Local Database con.open()
- ADO.NET : Error occurred while establishing a connection to SQL Server
- CreateUserWizard error during SetPropertyValue: Unable to connect to SQL Server database
- What’s the Concept of local database of sql server in .net
- Trying to connect to an Microsoft Sql database but get error instead
- Cannot insert data into SQL Server database
- I can’t connect to my local SQL Server database
- error deploying C# project with sql database : unable to open physical file
- How should I handle «&» in StringBuilder as later this is being used as XML and parsing that XML throws error in SQL Server database
- SQL Server connection string error cannot connect
- Where is the error in my syntax? Getting values from SQL Server database
More Query from same tag
- Resolving using Autofac within an object
- Retrieving Windows 8 product key
- How can set right-to-left align in devexpress gridcontrol component?
- Trouble loading images not in application folder Images
- Why am I likely to be getting an error in GDI in a c# screen recording app?
- Referencing a .Net Core 3.1 project from a .Net Standard Class Library
- Displaying an image in a foreach
- How can I change a cell of a DataGrid depending on the data it is bound to using MVVM?
- Add some extra work to SaveChangesAsync
- WPF — language changes only in MainWindow?
- Null Reference Exception when object is clearly defined
- SQL/C# Get ID of the row affected by Insert
- What does it mean to filter a collection ‘vertically’ and ‘horizontally’?
- How drag & drop and resize comnponents dynamically ASP.NET?
- ‘Session’ does not exist in the current context. How can I use it?
- Telling *.csproj formats apart
- Minify dynamically generated JavaScript at runtime for ASP.NET Core
- Self referencing loop detected for property when inserting into database
- Why does my Application.Exit(); call fail?
- what this code mean in wcf
- Perform Select at odd positions in the string
- Is there a way to internally set an object equal to a reference?
- Get Worksheets in Excel Workbook without opening file
- In SOAP i got a property as a json. How to pull properties from there and make new string
- Data type confusion when inheriting ToString() from base class
- Create JavaScript element within razor foreach loop
- SharePoint running a method when item added to a library
- Elements in list are getting overwritten when adding to list
- How to make a simple «encrypted» password in an ASP.NET MVC application?
- C# — Variable with 2 arguments, by string
In my previous blog post http://jaryl-lan.blogspot.my/2014/08/localdb-connection-to-localdb-failed.html. If you deploy your application to a client machine or server without installing the local database runtime, you will hit with an error of not able to access your local database file. But what if your application is a web based application that are hosted in IIS, you might hit with another error as shown below,
Unable to access SQLLocalDB: System.Data.SqlClient.SqlException (0x80131904): 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. )
Based on the above error message, it will be tough to identify what is going wrong but at the bottom of the message specifies that you can get more information in the Windows Application event log. So open up the event viewer and navigate to Application log, you will notice a few duplicate events shown as follows.
Event 1:
Windows API call SHGetKnownFolderPath returned error code: 5. Windows system error message is: Access is denied.
Reported at line: 422.
Event 2:
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.
Event 3:
Unexpected error occurred while trying to access the LocalDB instance registry configuration. See the Windows Application event log for error details.
From the events, the keyword here is «user profile is not loaded». So to get the user profile loaded, do the following:
(1) Open IIS Manager.
(2) On the left pane, navigate to Application Pools.
(3) Select the Application Pool used by your application, right click on it and click «Advanced Settings…«. A window titled «Advanced Settings» will be prompted.
(4) Look for Load User Profile under Process Model section and set its value to True.
(5) Recycle your Application Pool.
Once done, rerun your web application and it will be able to access the localdb. If you noticed that your application loads very slow on the first load, it is due to the localdb instance has not fully started yet. To identity which instance launched by your web application, navigate to Details tab in Task Manager, locate the instance sqlservr.exe with the username is same as your application pool’s name (That is if your application pool identity is set to ApplicationPoolIdentity).
Source: https://blogs.msdn.microsoft.com/sqlexpress/2011/12/08/using-localdb-with-full-iis-part-1-user-profile/
I am trying to build an ASP.NET MVC 5 Web Application which has a MyDatabase.mdf
file in the App_Data
folder. I have SQL Server 2014 Express installed with a LocalDb
instance. I can edit the database tables using the Server Explorer, however when I debug the application and go to a page where the database is needed I get the following 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: 50 — Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
So I looked in the Event Viewer under Application
and only see one Warning over and over again.
The directory specified for caching compressed content C:UsersUser1AppDataLocalTempiisexpressIIS Temporary Compressed FilesClr4IntegratedAppPool is invalid. Static compression is being disabled.
So I tried rebooting the server, still no go. Same error 50 as before.
I have created an class under Models
where I have a class called Post
.
namespace MyApplication.Models
{
public class Post
{
public int Id { get; set; }
public string Title { get; set; }
public string Content { get; set; }
}
public class MyDatabase : DbContext
{
public DbSet<Post> Posts { get; set; }
}
}
I also have a Controller
setup to list the posts from MyDatabase
.
namespace MyApplication.Controllers
{
public class PostsController : Controller
{
private MyDatabase db = new MyDatabase();
// GET: Posts
public ActionResult Index()
{
return View(db.Posts.ToList());
}
}
In my web.config
file the connection string looks like this…
<connectionStrings>
<add name="DefaultConnection"
connectionString="Data Source=(LocalDB)v12.0;AttachDbFilename=|DataDirectory|MyDatabase.mdf;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
I’ve tried the suggestion posted here but it didn’t work. Also tried this.
I also notice that the MyDatabase instance gets disconnected after I start running the application. If I refresh the database using Server Explorer in Visual Studio I can view the tables.
How is it that I can connect to the database and edit it within Visual Studio 2013 but when I debug the application it cannot connect to the database?
Breaking Changes to LocalDB: Applies to SQL 2014; take a look over this article and try to use (localdb)mssqllocaldb
as server name to connect to the LocalDB automatic instance, for example:
<connectionStrings>
<add name="ProductsContext" connectionString="Data Source=(localdb)mssqllocaldb;
...
The article also mentions the use of 2012 SSMS to connect to the 2014 LocalDB. Which leads me to believe that you might have multiple versions of SQL installed — which leads me to point out this SO answer that suggests changing the default name of your LocalDB «instance» to avoid other version mismatch issues that might arise going forward; mentioned not as source of issue, but to raise awareness of potential clashes that multiple SQL version installed on a single dev machine might lead to … and something to get in the habit of in order to avoid some.
Another thing worth mentioning — if you’ve gotten your instance in an unusable state due to tinkering with it to try and fix this problem, then it might be worth starting over — uninstall, reinstall — then try using the mssqllocaldb
value instead of v12.0
and see if that corrects your issue.
Hello,
I need to have my web application to be accessible on local network. I followed these two articles for publishing my web application on local IIS.
http://www.c-sharpcorner.com/uploadfile/francissvk/how-to-publish-asp-net-web-application-using-visual-studio-2/
http://www.c-sharpcorner.com/uploadfile/11d5d2/how-to-deploy-asp-net-website-in-iis-on-localhost/
My problem is that I get the following 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: 50 — Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.)
I’m using SQL Server 2014 express edition. Note that the application is fully functioning whe
n I run it from VS 2015 on the same machine.
I also get the following message when I test the connection of the application on IIS.
The server is configured to use pass-through authentication with a built-in account to access the specified physical path. However, IIS Manager cannot verify whether the built-in account has access. Make sure that the application pool identity has Read access to the physical path. If this server is joined to a domain, and the application pool identity is NetworkService or LocalSystem, verify that $ has Read access to the physical path. Then test these settings again.
What I have tried:
1. Check SQL Server remote connections are enable.
2. Enable TCP/IP on SQL Server Configuration
3. Open port 1433 for inbound/outbound connections.
Updated 20-Jul-20 10:34am
The problem was with localDB I was using for the ASP Identity part.
I created that database in SQL Server 2014 instead of having a localDB and worked.
Hopes it helps if someone else is having the same problem.
I’m using Visual Studio 2010 and Visual Studio 2015 Both are Doesn’t work in one pc.
so Please Uninstall visual studio Old Version.
Updated 20-Jul-20 10:35am
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Describe what is not working as expected.
I was trying to execute the command suggested in «Getting started… (https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db#install-entity-framework-core)
Scaffold-DbContext «Server=(localdb)<server_istance_name>;Database=Test2;Trusted_Connection=True;»
If you are seeing an exception, include the full exceptions details (message and stack trace).
Exception message:
Scaffold-DbContext "Server=(localdb)\desktop-ne78ema;Database=Test2;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
System.Data.SqlClient.SqlException (0x80131904): 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. Specified LocalDB instance name is invalid.
) ---> System.ComponentModel.Win32Exception (0x89C5011B): Unknown error (0x89c5011b)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.EntityFrameworkCore.SqlServer.Scaffolding.Internal.SqlServerDatabaseModelFactory.Create(DbConnection connection, IEnumerable`1 tables, IEnumerable`1 schemas)
at Microsoft.EntityFrameworkCore.SqlServer.Scaffolding.Internal.SqlServerDatabaseModelFactory.Create(String connectionString, IEnumerable`1 tables, IEnumerable`1 schemas)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, IEnumerable`1 tables, IEnumerable`1 schemas, String namespace, String language, String contextDir, String contextName, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions)
at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_1.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Stack trace:
Steps to reproduce
Include a complete code listing (or project/solution) that we can run to reproduce the issue.
Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
Console.WriteLine("Hello World!");
Further technical details
EF Core version: (found in project.csproj or packages.config)
Database Provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer)
Operating system:
IDE: (e.g. Visual Studio 2017 15.4)