How to add LocalDB to Visual Studio 2015 Community's SQL Server Object Explorer?

Lernkurve :

Problem

I don't understand how to make LocalDB show up in the SQL Server Object Explorer. On some VMs, it shows up automatically, on some other VMs, it doesn't. Still, after googling for hours, I don't get it.

Current situation

  1. I have a clean VM
  2. I installed Visual Studio 2015 Community (all default settings)
  3. I let a console application run (Entity Framework 6, code-first, console application) which worked on another VM and created a database automatically which then showed up in the SQL Server Object Explorer; but not this time

The error says:

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: 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.) ---> System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

So, on this VM, no database gets created and nothing shows up in the SQL Server Object Explorer's SQL Server node.

Connecting to LocalDB

What I think to know

  • Visual Studio 2015 Community comes with LocalDB; so everything should just work out of the box, but it doesn't, and I don't know why
  • LocalDB databases are just a pair of files (*.mdf and *.ldf)
  • I've seen the files being created at the default database location at C:\Users\<username>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB; but on this VM, there is no such folder
  • The App.config looked every time like this (and it was automatically created that way when I installed Entity Framework 6 the NuGet Package Manager in Visual Studio):

App.config

<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

Other random comments

  • Earlier, with SQL Server, it was necessary to open up certain ports, but LocalDB runs, as I understand it, as a separate process on demand when started by Visual Studio.
  • I don't know how to debug the SQLException
  • Does LocalDB not come packaged with Visual Studio 2015 Community and do I need to install it separately?
Gonzalo Lucero :

I had the same issue today recently installing VS2015 Community Edition Update 1.

I fixed the problem by just adding the "SQL Server Data Tools" from the VS2015 setup installer... When I ran the installer the first time I selected the "Custom" installation type instead of the "Default". I wanted to see what install options were available but not select anything different than what was already ticked. My assumption was that whatever was already ticked was essentially the default install. But its not.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

LocalDB not recognized in Visual Studio 2015

分類Dev

Visual Studio Community 2015、BSoD

分類Dev

How can I export an exe using Visual Studio Community 2015

分類Dev

Visual Studio Community 2015 won't sign in. How do I fix this?

分類Dev

Visual Studio Community 2015の有効期限

分類Dev

Unable to install extension for Visual Studio Community 2015 using .vsix file

分類Dev

What emulator to run with Visual Studio 2015 - Community edition for Xamarin to work>

分類Dev

Visual Studio 2015 Community keeps corrupting on Windows 10

分類Dev

Microsoft visual studio 2015 community crash when start installing

分類Dev

Visual Studio Server ExplorerでLocalDBに接続するにはどうすればよいですか?

分類Dev

SQL server2016 / Visual Studio2015のSSISOLEDB.12.0の問題

分類Dev

Visual Studio Community 2015内でXamarin for Androidを更新する方法

分類Dev

Visual Studio Community2015サービスは利用できません

分類Dev

Visual Studio 2015 Community EditionでType.GetTypeFromProgID()を使用する方法

分類Dev

Visual Studio Community 2015 Update1ビルドの問題

分類Dev

Microsoft Visual Studio Community2015のバージョンが遅い

分類Dev

C++ Error C3646, C2059, and C2238 Visual Studio 2015 (Community)

分類Dev

C++ Error C3646, C2059, and C2238 Visual Studio 2015 (Community)

分類Dev

Visual Studio Community 2015:アイドル時のCPUが高い

分類Dev

編集と続行が機能しない(C ++、Visual Studio Community 2015)

分類Dev

Visual studio 2015 - How to change default currency?

分類Dev

How to install .Net Core on Visual Studio 2015?

分類Dev

Visual Studio Community2015をVisualStudio Professional2015に簡単に更新できますか

分類Dev

Visual Studio + Windows10のlocaldb

分類Dev

Add new device to xaml layout designer Visual Studio 2015 UWP

分類Dev

Qt Visual Studio 2015 Add-in compilation problem

分類Dev

Visual Studio 2015 Team Explorer doesn't see existing local repository clone

分類Dev

Team Explorer Visual Studio2015に除外がありません

分類Dev

Visual Studio 2015

Related 関連記事

  1. 1

    LocalDB not recognized in Visual Studio 2015

  2. 2

    Visual Studio Community 2015、BSoD

  3. 3

    How can I export an exe using Visual Studio Community 2015

  4. 4

    Visual Studio Community 2015 won't sign in. How do I fix this?

  5. 5

    Visual Studio Community 2015の有効期限

  6. 6

    Unable to install extension for Visual Studio Community 2015 using .vsix file

  7. 7

    What emulator to run with Visual Studio 2015 - Community edition for Xamarin to work>

  8. 8

    Visual Studio 2015 Community keeps corrupting on Windows 10

  9. 9

    Microsoft visual studio 2015 community crash when start installing

  10. 10

    Visual Studio Server ExplorerでLocalDBに接続するにはどうすればよいですか?

  11. 11

    SQL server2016 / Visual Studio2015のSSISOLEDB.12.0の問題

  12. 12

    Visual Studio Community 2015内でXamarin for Androidを更新する方法

  13. 13

    Visual Studio Community2015サービスは利用できません

  14. 14

    Visual Studio 2015 Community EditionでType.GetTypeFromProgID()を使用する方法

  15. 15

    Visual Studio Community 2015 Update1ビルドの問題

  16. 16

    Microsoft Visual Studio Community2015のバージョンが遅い

  17. 17

    C++ Error C3646, C2059, and C2238 Visual Studio 2015 (Community)

  18. 18

    C++ Error C3646, C2059, and C2238 Visual Studio 2015 (Community)

  19. 19

    Visual Studio Community 2015:アイドル時のCPUが高い

  20. 20

    編集と続行が機能しない(C ++、Visual Studio Community 2015)

  21. 21

    Visual studio 2015 - How to change default currency?

  22. 22

    How to install .Net Core on Visual Studio 2015?

  23. 23

    Visual Studio Community2015をVisualStudio Professional2015に簡単に更新できますか

  24. 24

    Visual Studio + Windows10のlocaldb

  25. 25

    Add new device to xaml layout designer Visual Studio 2015 UWP

  26. 26

    Qt Visual Studio 2015 Add-in compilation problem

  27. 27

    Visual Studio 2015 Team Explorer doesn't see existing local repository clone

  28. 28

    Team Explorer Visual Studio2015に除外がありません

  29. 29

    Visual Studio 2015

ホットタグ

アーカイブ