locked
Can't Run LS Beta 2 Project RRS feed

  • Question

  • Just installed Beta 2, created a data source to a SQL Server database, created a screen and ran the program. Keep getting this error:

    Error    67    An error occurred while establishing a connection to SQL Server instance '.\'.
    The user instance login flag is not supported on this version of SQL Server. The connection will be closed.    C:\Program Files\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0\Microsoft.LightSwitch.targets    157    10    RepairCenterDiagnostics

    Any ideas?

    Thanks,

    David McCarter

     

     


    Microsoft MVP
    Friday, March 18, 2011 8:41 PM

Answers

  • Hi Yann,

    SQL Express is necessary because at development time, LightSwitch uses a User Instance of the database (this automatically attaches the database "on-the-fly" to the SQL service. Only SQL Express supports this option. If we didn't do it this way then you would not be able to easily share LightSwitch solutions with other developers or "F5" samples.

    Hope this makes more sense now.

    Cheers,
    -Beth

     

     

     


    Senior Program Manager, Visual Studio Community http://msdn.com/lightswitch http://msdn.com/vbasic http://msdn.com/vsto http://www.bethmassi.com
    Thursday, March 24, 2011 10:51 PM
  • This is probably due to one of three issues:

    1) You don't have SQL Express installed or a SQL Express Instance Running. LightSwitch requires SQL Express for Development.

    2) If you do have SQL Express installed you need to turn on user instances for your SQL Express Instance. LightSwitch should have done this for you as part of the install, but if you already had SQL Express installed then it would not. You can enable this by running the following SQL command against your instance’s master database: sp_configure 'user instances enabled','1'

    3) That brings me to option three. If you have multiple SQL Express instances running you need to make sure the default SQL Express instance is named properly. Can you check your VS IDE’s default SQL Server Instance Name in Tools Options under Tools>Options>Database Tools>Database Connections.  Its value will need to match the SQL Express instance name that you’re running (you can ascertain your machine’s SQL Express instance name by opening up a command prompt and typing ‘net start’ to list all running services). 

    I hope at least one of those helps.


    Patrick Baker
    Saturday, March 19, 2011 4:52 AM

All replies

  • This is probably due to one of three issues:

    1) You don't have SQL Express installed or a SQL Express Instance Running. LightSwitch requires SQL Express for Development.

    2) If you do have SQL Express installed you need to turn on user instances for your SQL Express Instance. LightSwitch should have done this for you as part of the install, but if you already had SQL Express installed then it would not. You can enable this by running the following SQL command against your instance’s master database: sp_configure 'user instances enabled','1'

    3) That brings me to option three. If you have multiple SQL Express instances running you need to make sure the default SQL Express instance is named properly. Can you check your VS IDE’s default SQL Server Instance Name in Tools Options under Tools>Options>Database Tools>Database Connections.  Its value will need to match the SQL Express instance name that you’re running (you can ascertain your machine’s SQL Express instance name by opening up a command prompt and typing ‘net start’ to list all running services). 

    I hope at least one of those helps.


    Patrick Baker
    Saturday, March 19, 2011 4:52 AM
  • I'm curious why I need SQL Server Express when I already have SQL Sever installed?

    David


    Microsoft MVP
    Thursday, March 24, 2011 7:44 PM
  • Thursday, March 24, 2011 8:54 PM
  • Ravi,

    I have seen this issue raised by several people now & the team don't seem to be "listening" to what is actually being asked. Can you please explain WHY the intrinsic data cannot be stored in a pre-existing SQL database for development (the same as it is when deployed)?

    The LS setup process *could* ask for a SQL instance to use (could it not?), & if there isn't one, or the "non-developer" has no idea what this means, THEN LS could install & use a SQL Express instance behind the scenes.

    Most of us that already have a SQL instance have installed it becuase that's what we want to use. Most software ASKS if there is an existing instance to install to & then installs its own instance only if one is not specified.

    So, in a nutshell, please stop telling us that LS needs to store the intrinsic data in a SQL Express instance & tell us why it can't store it in a SQL instance that already exists.

    Thanks,

    Yann

    Thursday, March 24, 2011 10:40 PM
  • Hi Yann,

    SQL Express is necessary because at development time, LightSwitch uses a User Instance of the database (this automatically attaches the database "on-the-fly" to the SQL service. Only SQL Express supports this option. If we didn't do it this way then you would not be able to easily share LightSwitch solutions with other developers or "F5" samples.

    Hope this makes more sense now.

    Cheers,
    -Beth

     

     

     


    Senior Program Manager, Visual Studio Community http://msdn.com/lightswitch http://msdn.com/vbasic http://msdn.com/vsto http://www.bethmassi.com
    Thursday, March 24, 2011 10:51 PM
  • Hi Beth,

    Ok, yes, that makes sense. Thank you for the clear explanation.

    I have also seen people suggest that SQL CE could have been used. I haven't used it so I don't know if your "only SQL Express" supports this option" included CE as also not being capable, or if you didn't consider it, so I just thought I'd ask to make sure?

    Thanks again,

    Yann

    Thursday, March 24, 2011 11:41 PM
  • The architects can chime in here but I believe the decision was made this way so that you would have a consistent development-thru-deployment experience. SQL CE doesn't support the feature set that SQL Express/Sever does and since LightSwitch apps are multi-user, etc. you need to deploy them the SQL Express/Server.

    HTH,
    -Beth

     


    Senior Program Manager, Visual Studio Community http://msdn.com/lightswitch http://msdn.com/vbasic http://msdn.com/vsto http://www.bethmassi.com
    Friday, March 25, 2011 12:24 AM
  • OK, fair enough..

    Thanks!

    Yann

    Friday, March 25, 2011 4:36 AM
  • Hi Beth...

    I ran over the same issue...

    Can LS be used with SQL Server 2005 Express SP4 or is it dependent of SQL Server 2008 Express ???

     

    Thx,,,

    You're the Be(s/t)h    ;-)

     

    ZEE


    --------------- ~~~oO ZEE Oo~~~ ---------------
    Tuesday, April 5, 2011 10:17 PM
  • Yes. LightSwitch supports SQL Server 2005 Express. If you have the default instance name set correctly then everything should work the same.

    Thanks.


    Patrick Baker (Visual Studio LightSwitch Test Lead)
    Wednesday, April 6, 2011 3:25 PM
  • Seems I already have SQL Express installed. I ran the sp_configure statement but I get this error:

    Configuration option 'user instances enabled' changed from 1 to 1. Run the RECONFIGURE statement to install.

    Any ideas?

    David


    Microsoft MVP
    Wednesday, April 6, 2011 9:18 PM
  • Hi David

    Can you check the following setting to see if this helps?

    1. Open Visual Studio LightSwitch
    2. Select the 'Tools>Options' menu item
    3. Enable 'Show all settings' checkbox in the Options dialog
    4. Expand the Database Tools group and select the 'Data Connections' options page
    5. Check the setting of the option 'SQL Server Instance Name (blank for default)'

    Make sure this value is set to the SQL Express instance which has User Instances enabled.  Change the value and click Ok.

    Note: Changes to this value will only affect new projects created, existing projects will have to be manually updated in the App.config file which resides in the root project folder.

    Hope this helps,

    Mike

    Wednesday, April 6, 2011 10:18 PM
  • Ok, I changed the setting in Options, created a new project and I still get:

    Error    1    An error occurred while establishing a connection to SQL Server instance '.\'.
    The user instance login flag is not supported on this version of SQL Server. The connection will be closed.    C:\Program Files\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0\Microsoft.LightSwitch.targets    157    10    RepairCenterAdmin

     

    When I looked at the app.config, the connection string was this:

    "Data Source=.\SQLEXPRESS;AttachDbFilename="|DataDirectory|\Data\DevelopmentDatabase.mdf";Integrated Security=True;User Instance=True;MultipleActiveResultSets=True;Pooling=False;"

    I changed it to:

    connectionString="Data Source=RCDEV15DPM\SQLEXPRESS;AttachDbFilename="|DataDirectory|\Data\DevelopmentDatabase.mdf";Integrated Security=True;User Instance=True;MultipleActiveResultSets=True;Pooling=False;"

    And I get the same error.

    Any suggestions?

    David


    Microsoft MVP
    Friday, April 8, 2011 10:02 PM
  • I am seeing this in the event log:

    The user instance login flag is not supported on this version of SQL Server. The connection will be closed. [CLIENT: <local machine>]

    David


    Microsoft MVP
    Friday, April 8, 2011 10:04 PM
  • Hi David,

    It looks to me like user instances is not enabled on your SQL Server Express.

    As I understand this would normally be turned on by the LS setup program, but if your SQL Express was already installed, I guess it's possible that LS left it alone. It may not be your problem, but it's worth a try.

    To enable user instances, try:

    Open the SQL Server Management Studio.
    Connect the SQL Express instance.
    In the query editor type this text: exec sp_configure 'user instances enabled', 1
    Then type: Reconfigure
    Then restart the SQL Server database.

    See if that helps,

    Yann

    Saturday, April 9, 2011 4:21 AM
  • I did what you recommended above, created a new project and I'm still getting this error:

     

    Error    1    An error occurred while establishing a connection to SQL Server instance '.\'.
    The user instance login flag is not supported on this version of SQL Server. The connection will be closed.    C:\Program Files\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0\Microsoft.LightSwitch.targets    157    10    ErrorViewer

     

    David


    Microsoft MVP
    Friday, April 22, 2011 7:19 PM
  • Hi David,

    Based on what I see in that error message, the instance name itself isn't right, so the resulting error message might in fact be misleading.

    You should be able to have just ".", or ".\SQLEXPRESS" (or even a blank name in the VS options), but I don't think ".\" is valid for the SQL Express instance, *especially* if it's the one installed by LS & not one of your own.

    I don't profess to be a SQL *expert*, but that doesn't seem right to me, from my experience.

    Yann

    Saturday, April 23, 2011 2:37 AM
  • Hi,

    I'm running LightSwitch some time now and all of a sudden it says:

    Error 1 An error occurred while establishing a connection to SQL Server instance '.\SQLEXPRESS'.
    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: 26 - Error Locating Server/Instance Specified) C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0\Microsoft.LightSwitch.targets 157 10 GradesOnlineAdmin

    This is correct though, I have turned off my SQLEXPRESS named instance and my MSSQLSERVER instance is handling all the databases. This worked fine the couple of days, until now.

    I modified the Tools>Database Connections name to MSSQLSEVER and even tried a blank one. I alse rebooted VS10. I searched in all files in the solution but there is no reference to the .\SQLEXPRESS anywhere...

    Please help!

    Sunday, May 8, 2011 8:26 PM
  • Hi,

    I'm running LightSwitch some time now and all of a sudden it says:

    Error 1 An error occurred while establishing a connection to SQL Server instance '.\SQLEXPRESS'.
    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: 26 - Error Locating Server/Instance Specified) C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0\Microsoft.LightSwitch.targets 157 10 GradesOnlineAdmin

    This is correct though, I have turned off my SQLEXPRESS named instance and my MSSQLSERVER instance is handling all the databases. This worked fine the couple of days, until now.

    I modified the Tools>Database Connections name to MSSQLSEVER and even tried a blank one. I alse rebooted VS10. I searched in all files in the solution but there is no reference to the .\SQLEXPRESS anywhere...

    Please help!


    By the way, both are SQL EXPRESS editions. The MSSQLSERVER instance is a R2 version.
    Sunday, May 8, 2011 8:29 PM
  • Sunday, May 8, 2011 8:49 PM