locked
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance.

    Question

  • First application, first build but bit unlucky. Why is above error? I can create database in visual studio using sql express but not in lightswitch! User Instance is enabled, and it is Windows 7 machine. Can I not change this configuration database connection string to another sql server? or is there any solution to above problem.

    Thanks

    Thursday, August 19, 2010 4:29 PM

Answers

  • Hi Dinky30

    Can you try this:

    1. Stop all user instance processes of SQL Server running under your local account (open up task manager and look for sqlsrv.exe process and end it)

    2. Delete all files in the %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS folder

    3. F5 again

    The problem is known issue. SQL Express cannot create a user instance using the set of engine files in your local app data folder, deleting them should allow sql server to recreate them with the correct credentials for you to F5 successfully.

    Hope this helps,

    Mike

    Thursday, August 19, 2010 5:58 PM

All replies

  • Hi Dinky30

    Can you try this:

    1. Stop all user instance processes of SQL Server running under your local account (open up task manager and look for sqlsrv.exe process and end it)

    2. Delete all files in the %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS folder

    3. F5 again

    The problem is known issue. SQL Express cannot create a user instance using the set of engine files in your local app data folder, deleting them should allow sql server to recreate them with the correct credentials for you to F5 successfully.

    Hope this helps,

    Mike

    Thursday, August 19, 2010 5:58 PM
  • Hi,

    This is a known issue that is documented in the ReadMe:

    In some instances, a user instance of SQL Express cannot be created for the current user.  Executing Build/F5/Ctrl+F5 on a LightSwitch project causes a build error: "An error occurred while establishing a connection to SQL Server instance '.\SQLEXPRESS'." "Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed."

     

    This error appears to occur due to data corruption in a SQL Express directory used to create the user instance. It can be corrected by deleting the directory; no data will be lost.

    To resolve this issue:

    1.   Save and Close your LightSwitch project
    2.   Stop all instances of SQL Express on your local machine
    3.   End all user instance processes of SQL Express (process name: sqlservr.exe owner will be currently logged in user)
    4.   Delete all files in %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS
    5.   Restart all SQL Express instances on your local machine
    6.   Open your LightSwitch project and rebuild all


    Steve Hoag Microsoft aka the V-Bee
    Thursday, August 19, 2010 5:59 PM
  • I have the same problem, but I don't have SQLExpress on my machine, so the directories don't exist.
    Tuesday, August 24, 2010 12:47 AM
  • If you have installed LightSwitch, you do have SQL Express on your machine - it's required.

     


    Steve Hoag Microsoft aka the V-Bee
    Tuesday, August 24, 2010 12:55 AM
  • Thank you.  I did have SQLExpress installed at one time, but I have the full version of SQL on my machine right now.  I uninstalled SQLExpress.  Perhaps the installer detected remnants of that installation.  Do you think I need to reinstall/repair SQLExpress? 
    Tuesday, August 24, 2010 4:26 AM
  • Yes, you will need to reinstall the version of SQL Express that was included in the LightSwitch setup.
    Steve Hoag Microsoft aka the V-Bee
    • Proposed as answer by swhitley Friday, August 27, 2010 11:36 PM
    Tuesday, August 24, 2010 4:39 AM
  • There is something very wrong with Lightswitch. I have SQLExpress instance called SQLExpress upgraded to standard and I have SQLExpress instance called SQLExpress2 that is SQLExpress2. I changed SQLExpress to SQLExpress2 everywhere in LightSwitch config but when I try to run it it still gives me this error and looks for SQLExpress. Are you guys really hardcoding instance names and other stuff to code? :O:O:O

    What I have to change to get LightSwitch work with correct instance? Reinstalling LightSwitch changed nothing btw.

    With best regards,
    Gunnar Peipman
     
    Also visit my ASP.NET and SharePoint blog!
    Friday, September 10, 2010 12:42 PM
  • Okay, I uninstalled MSSQL Standard from SQLExpress and re-installed SQL Server Express as this instance. Now suddenly LightSwitch works. Can you guys, please, at next time avoid such technical disqualities and non-sense? Why don't you test your software in-house enough to avoid such stupid things from going to tusers? Omg...
    With best regards,
    Gunnar Peipman
     
    Also visit my ASP.NET and SharePoint blog!
    Friday, September 10, 2010 1:50 PM
  • Thanks for the thoughts and suggestions here.

    Question for Steve:

    LightSwitch setup includes the SQL 2008 Express version, yes?  

    I upgraded my version to SQL Express R2 so that I can take advantage of Report Builder 3.0.

    What is the correct procedure to install LightSwitch so that it works with SQL Express R2?

     

    Saturday, October 02, 2010 12:28 AM
  • I finally was able to connect to .SQLEXPRESS and have also Upgraded to SQL Express R2 for Report Services. As developers we are not always able to focus on just one area, and dont have resources to have dedicated development machines for each piece of MC Development technology.

    I have searched the Prjoect for .SQLEXPRESS and renamed it to the correc entance with no luck. tried the steps in this thred still no luck.  I even went as far as creating an empty ApplicationDatabase and DevelopmentDatabase and change the connection string everywhere in the Solution and still no luck.

    It is a nice idea and I love the concepts of LighSwitch can't wait until it is in beta 2 and these sort of issues are removed.

     Also should add that I was unable to follow these directions for an existing project, but now my new projects work without uninstalling SQL Express R2.

     

    Thanks for the post.


    Thank you!
    Monday, October 18, 2010 12:52 AM
  • The instructions work like a champ, thanks!

    All be aware that if you are using XP the location will be something like

    C:\Documents and Settings\<Insert your User Id Here>\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

    Regards

    Cliff

    Thursday, December 02, 2010 5:45 AM
  • Hi,

    This is a known issue that is documented in the ReadMe:

    In some instances, a user instance of SQL Express cannot be created for the current user.  Executing Build/F5/Ctrl+F5 on a LightSwitch project causes a build error: "An error occurred while establishing a connection to SQL Server instance '.\SQLEXPRESS'." "Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed."

     

    This error appears to occur due to data corruption in a SQL Express directory used to create the user instance. It can be corrected by deleting the directory; no data will be lost.

    To resolve this issue:

    1.   Save and Close your LightSwitch project
    2.   Stop all instances of SQL Express on your local machine
    3.   End all user instance processes of SQL Express (process name: sqlservr.exe owner will be currently logged in user)
    4.   Delete all files in %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS
    5.   Restart all SQL Express instances on your local machine
    6.   Open your LightSwitch project and rebuild all

     


    Steve Hoag Microsoft aka the V-Bee

    Still having this issue after follow step by step your solution:

    Error 1 An exception occurred when building the database for the application.

    Método no encontrado: 'Void Microsoft.Data.Schema.Sql.SchemaModel.ISqlSimpleColumn.set_IsIdentity(Boolean)'. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0\Microsoft.LightSwitch.targets 95 10 LightSwitchApp1

    Any idea? Thanks :)

    Saturday, January 22, 2011 10:47 AM
  • Guys, I'm not able to relocate following folder on my Windows 7

    %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS folder

    Need help to run light switch application.

    thanks in advance.


    Thanks, Sandip
    Monday, March 14, 2011 5:11 PM
  • The folder in question wont' show up via UI if system objects are hidden (the default config for Win 7)

    run CMD as administrator

    do CD to the directory in question in the command window

    del *.*

    Restart SQLEXPRESS.


    Garth H MCITP | BI 2008 MCTS | SQL 2005 & SharePoint 2010 http://bitinkering.spaces.live.com/
    Wednesday, March 23, 2011 1:14 AM
  • I am running Beta 2 in Win 7 and have the same problems as above, I have deleted the files as sugested in %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS folder and rebuilt the project but the error is still the same.

    Anyone any ideas?

    Tuesday, April 05, 2011 6:48 PM
  • I have same problem.....even deleting the problem persists
    Rajamannar Chief Surface Addict Xface
    Wednesday, April 20, 2011 8:26 AM
  • Did you restart SQL Server Express in Control Panel > Administrative Tools > Services ?
    Wednesday, April 20, 2011 9:01 AM
  • Well - I've spent the better part of today attempting to get the LightSwitch tutorial introduction working but am getting up tight about it so guess I'll drop it and go back to my old ways....   Did get around the 'known' error by deleting the \sqlexpress directory work files and restarting everything. 

    I all seems to hang together until it attempts to show the grid.  I've even attempted to pre-populate the Contacts table with data and still says 'unable to load data, check network connectivity and try again'.  of course this is all running localhost with sqlexpress and even though the database is completely accessible via any other method your LightSwitch STAYS DIM - sorry but this kind of complexity is not what we had in mind with a nearly 'Access' type of non-technical approach to developing quick apps in support of departmenQuestiontal needs.

     

    I'll post this also under the quoted error message (of course the message didn't arrive in a standard dialog box so couldn't Print Screen it).

     


    Frank Towle
    Tuesday, June 07, 2011 9:41 PM
  • I replied to your other post.
    Plus ça change, plus c'est la même chose!
    Tuesday, June 07, 2011 11:01 PM