SQL网络接口,error:50 - 本地数据库运行时发生了错误。指定的LocalDB实例不存在 [英] SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. The specified LocalDB instance does not exist

查看:5281
本文介绍了SQL网络接口,error:50 - 本地数据库运行时发生了错误。指定的LocalDB实例不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑: 一个重要的细节,我原来的离开了(因为我不知道这是重要的)是我们运行在完整的IIS这些网站,而不是从IIS防爆preSS。


我们正在努力建立本地开发环境中Kentico CMS将本地计算机添加到我们开发的当前同步链 - >分期 - >正式版(所以我们会与当地人风 - >开发 - - >分期 - >正式版)

我们复制了我们开发DB我们的本地计算机上(的LocalDB)\\ V11.0 SQL Server实例,但我们除了矿山运行到一个问题,每个人的电脑。

下面是我们得到的错误:


  

应用程序无法连接到数据库,请检查
  连接字符串在web.config文件和SQL服务器的可用性。


  
  

原来的错误:


  
  

发生-特定实例的网络相关的或错误而
  与SQL Server建立连接。服务器没有被发现或
  无法访问。验证实例名称是否正确,以及
  SQL Server配置为允许远程连接。 (提供者:SQL
  网络接口,error:50 - 本地数据库运行时发生了错误。
  指定的LocalDB实例不存在。 )


我试过一吨的其他SO答案和其他网站的建议,以弄清楚为什么我们得到这个错误(和为什么它没有发生在我的机器上),但没有运气。我们可以连接到SSMS(的LocalDB)\\ V11.0,但我们无法通过VS(同样的错误)连接到它。此外,当我们打开SQL Server配置管理器中,我们没有看到SQL Server服务的任何物品。任何想法?


解决方案

  1. 确保您已的.NET Framework 4.0.2以上安装

  2. 设置你的程序池NetworkService帐户下运行。

  3. 创建您的分贝该帐户登录。

    使用[大师]
    CREATE LOGIN [NT AUTHORITY \\ NETWORK SERVICE] FROM WINDOWS;
    EXEC sp_addsrvrolemember N'NT AUTHORITY \\ NETWORK SERVICE',SYSADMIN;


  4. 分享您的实例运行的所有用户
    SqlLocalDB份额Kentico KenticoShared


  5. 在使用以下格式的连接字符串:

<添加名称=CMSConnectionString的connectionString =数据源=(的LocalDB)\\ \\ KenticoShared;初始目录= KenticoDB;集成安全性= TRUE;连接超时= 60/>

<醇开始=6>
  • 如果它不能帮助使用命名管道:<​​/ li>

    &LT;添加键=CMSConnectionStringVALUE =坚持安全信息=假;集成安全性= SSPI;数据库= KenticoDB;服务器= NP:\\\\。\\管道\\的LocalDB#D2BA6590 \\ TSQL \\查询;当前语言=英语;连接超时= 120; /&GT;

    注:


    1. 您的机器上的网络服务帐户的确切名称,可以通过运行下面的C#确定

    VAR NS =新的SecurityIdentifier(WellKnownSidType.NetworkServiceSid,NULL).Translate(typeof运算(NTACCOUNT))。的ToString()

    <醇开始=2>
  • 命名管道,可以通过在CMD运行这个决定: SqlLocalDB信息KenticoShared

  • 请不要忘了运行实例 SqlLocalDB开始KenticoShared

  • EDIT: One important detail that I original left out (because I didn't know it was important) is that we were running these sites in full IIS, not from IIS Express.


    We're trying to setup local dev environments for Kentico CMS that will add our local machines to our current synchronization chain of Dev --> Staging --> Prod (so we'll wind up with Locals --> Dev --> Staging --> Prod).

    We copied our Dev DB to our local machines onto the (localdb)\v11.0 instance of SQL Server, but we're running into an issue on everyone's computers except mine.

    Here's the error we're getting:

    The application could not connect to the database, please check the connection string in the web.config file and SQL server availability.

    Original 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. )

    I've tried a ton of suggestions from other SO answers and other websites to figure out why we're getting this error (and why it's not happening on my machine), but no luck. We can connect to (localdb)\v11.0 in SSMS but we cannot connect to it through VS (same error). Also, when we open Sql Server Config Manager, we're not seeing any listings for SQL Server Services. Any ideas?

    解决方案

    1. Make sure you have .NET Framework 4.0.2+ installed
    2. Set up your AppPool to run under the NetworkService account.
    3. Create a login for that account in your db.

      USE [master]; CREATE LOGIN [NT AUTHORITY\NETWORK SERVICE] FROM WINDOWS; EXEC sp_addsrvrolemember N'NT AUTHORITY\NETWORK SERVICE', SYSADMIN;

    4. Share your instance with all users by running SqlLocalDB share Kentico KenticoShared

    5. Use connection string in the following format:

    <add name="CMSConnectionString" connectionString="Data Source=(localdb)\.\KenticoShared;Initial Catalog=KenticoDB;Integrated Security=True;Connect Timeout=60" />

    1. If it doesn't help use a named pipe:

    <add key="CMSConnectionString" value="Persist Security Info=False;Integrated Security=SSPI;database=KenticoDB;server=np:\\.\pipe\LOCALDB#D2BA6590\tsql\query;Current Language=English;Connection Timeout=120;" />

    Notes:

    1. the exact name of the NetworkService account on your machine can be determined by running following C#

    var ns = new SecurityIdentifier(WellKnownSidType.NetworkServiceSid, null).Translate(typeof(NTAccount)).ToString()

    1. named pipe can be determined by running this in CMD: SqlLocalDB info KenticoShared
    2. don't forget to run your instance SqlLocalDB start KenticoShared

    这篇关于SQL网络接口,error:50 - 本地数据库运行时发生了错误。指定的LocalDB实例不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆