locked
50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details RRS feed

  • Question

  • Step1: Opened Lightswtich

    Step2: selcted DB and Table Through wizard.

    Step 3: while Build the application getting the following error

    Error 1 An error occurred while establishing a connection to SQL Server instance '(LocalDB)\v11.0'.
    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.
    ) C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v2.0\Microsoft.LightSwitch.targets 146 10 Testproj2

    Could you please recommend, what i have to solve this issue, i am very new to lightswitch.

    Thank you.


    Monday, April 8, 2013 7:39 AM

Answers

  • Hi,

    LightSwitch used SQL Server 2012 Express LocalDB for tables created by LightSwitch. The error indicated that your SQL Server 2012 Express LocalDB is not working.

    First thing to check is to make sure that you have Microsoft SQL Server 2012 Express LocalDB installed on your machine (using Uninstall or change a program window). If not, this article is a good introduction to it and how to install it.

    Second thing to check is to make sure the SQL Server (SQLEXPRESS) service is running (using Services window).

    If there are issues with the service itself, either repair the instance or this article has good trouble-shooting steps.

    Best regards,
    Huy Nguyen

    • Proposed as answer by Angie Xu Wednesday, April 24, 2013 7:32 AM
    • Marked as answer by Angie Xu Tuesday, May 7, 2013 3:15 AM
    Monday, April 8, 2013 4:50 PM

All replies

  • Hi,

    LightSwitch used SQL Server 2012 Express LocalDB for tables created by LightSwitch. The error indicated that your SQL Server 2012 Express LocalDB is not working.

    First thing to check is to make sure that you have Microsoft SQL Server 2012 Express LocalDB installed on your machine (using Uninstall or change a program window). If not, this article is a good introduction to it and how to install it.

    Second thing to check is to make sure the SQL Server (SQLEXPRESS) service is running (using Services window).

    If there are issues with the service itself, either repair the instance or this article has good trouble-shooting steps.

    Best regards,
    Huy Nguyen

    • Proposed as answer by Angie Xu Wednesday, April 24, 2013 7:32 AM
    • Marked as answer by Angie Xu Tuesday, May 7, 2013 3:15 AM
    Monday, April 8, 2013 4:50 PM
  • In my case when I looked at Windows Event Log I found the following message:

    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.

    Searched Google and found this great post:

    Using LocalDB with Full IIS, Part 1: User Profile

    My specific problem was that I deployed an ASP.NET MVC 4 app to a new Website in my local IIS and it created a new application pool. As the post above describes one must enable setProfileEnvironment=true for the AppPool in the file C:\Windows\System32\inetsrv\config\applicationHost.config.

    So I had this:

    <add name="MyAppPoolName" />

    I had to change it to:

    <add name="MyAppPoolName" />
    <processModel identityType="ApplicationPoolIdentity"
    loadUserProfile="true"
    setProfileEnvironment="true" />
    </add>

    After changing the config code, don't forget to restart the app pool.

    Now you should read this second post to deal with LocalDb Instance Ownership:

    Using LocalDB with Full IIS, Part 2: Instance Ownership


    Leniel Macaferi http://leniel.net








    Tuesday, April 30, 2013 3:28 PM
  • Leniel Macaferi

    I've tried the configuration steps detailed in your reference

    Using LocalDB with Full IIS, Part 1: User Profile

     and repeated above and, when I go to IIS and try to restart the app pool, I'm told that setProfileEnvironment is an unrecognized attribute.

    Win Server 2008 Standard SP2

    Sql Server Express 2012 (LocalDB)

    IIS 7

    .NET 4.5

    Any thoughts?

    Cliff

    Thursday, June 20, 2013 6:14 PM
  • Cliff,

    I have no idea what's going on with your machine... maybe you should follow what's described here:

    http://forums.iis.net/t/1178788.aspx/1


    Leniel Macaferi http://leniel.net


    Friday, June 21, 2013 3:03 PM
  • I got this error as well even though SQL server was showing as running in Configuration Manager.  I restarted the server and tried connecting again.  It worked.
    Wednesday, March 22, 2017 5:40 PM