locked
Failed to generate a user instance of SQL Server RRS feed

  • Question

  • Hello Everyone,
    I have instaled SQLExpress September on my Windows Server 2003 Standard.
    and I work on a windows XP SP2 for development using Visual studio Web Edition (Beta2) which comes with sql server 2005 too.
    I've built my application and tested it on my computer and everything went fine.
    But When I copied the application to the server, it showed the following error:

    "Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed."

    I've read alot of threads but it doesn't seem that any of them deals with my problem.
    Friday, November 4, 2005 11:04 PM

Answers

  • I've had to add new line to my connection string in web.config file to fix the problem:

    <connectionStrings>
      <remove name="LocalSqlServer"/>
      <add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>

    Then the  IIS application pool I used an acount that has a local user profile (local system is an example) but this could make a security hole in your system.

    Hope this was helpful

    Wednesday, March 8, 2006 8:16 AM

All replies

  • This is because of a known problem in Windows. See http://support.microsoft.com/default.aspx?scid=kb;en-us;896613 for more details.

    Thanks

    • Proposed as answer by Manas Mukherjee Wednesday, January 13, 2010 12:35 PM
    Monday, November 14, 2005 8:51 PM
  • Dear Sir,
    Thanks for your reply, but I'm using Windows server 2003 Web Edition on my server.
    Monday, November 14, 2005 9:59 PM
  • While I might be suggesting the obvious, but have you checked what the error suggests?

    What account SQL Server is running under? If it is a user account, does it have a user profile?

    If you create an app that just connects to a SQL Server instance, does it work?

    Tuesday, November 15, 2005 1:01 AM
  • Q:have you checked what the error suggests?
    A:what I wrote in the first message was what I got as a suggestion
    Q:What account SQL Server is running under?
    A:I connect using the administrator account.
    Q:does it have a user profile?
    A:To be honest with you,
    Second, SQL Server connects using "Network Service"
    The error suggests checking the local user profile, I've checked it, it only shows profile1.
    Q:If it is a user account, does it have a user profile?
    A:Yes its a user account,about user profile it has one, but do I need to do any extra configs especially for SQL express?
    Q:If you create an app that just connects to a SQL Server instance, does it work?
    A:when I create one through VS2005 and start it from VS it works fine, but when I copy it to the inetpub location it shows the error. strange!

    Boris Bon thanks for trying to help, I appreciate it... Smile but still no solution

    Wednesday, November 16, 2005 8:50 PM
  • Dennis,

    The reason for the error your are seeing is that the account under which you are trying to create a user instance of SQL Express does not have a local profile on the server. The error message suggests verifying this.

    To fix this you either need to locally login using that account or adjust your impersonation settings on the application or modify the connection string.

    When you are working in VS you are using an account which does have a local profile, so this problem does not exist. When however, you copy the application to the Intepub folder you are starting to run application in a different user context, thus the problem.

    Describe your application in greater detail. Is it ASP.NET app? Does it use impersonation? Is the IIS server on the same machine where you develop the application? How does you connection string look like? How do you change it when you move the application?

    You misunderstood my previous questions.

    Account SQL Server running under is not the same thing as the account you use to connect to SQL Server. Apparently, you are running SQL Server as NETWORK SERVICE. Next, profile1 looks like a hardware profile, not a user profile, what you need to check is User profiles on Advanced Tab of System properties.

    You may also want to look in the error log to understand what account it tries to create a user instance under.

    Boris.

    Thursday, November 17, 2005 3:40 AM
  • Well, I was able to solve my problem as follows:
    I checked my IIS Application pool that my domain uses, it appeare that I it was using an account that doesn't have a local user profile, so I changed the Application pool Identity to local system and it started working...
    Thanks for everyone that has been trying to help...

    • Proposed as answer by mipguide Friday, July 2, 2010 6:42 AM
    Saturday, November 19, 2005 8:33 AM
  • i did try to change "IIS Admin" Windows service to run as administrator, which has a local user profile, but it still didn't work in my case (running iis on xp professional, IIS version 5.0)

    Sorry, i am new to IIS  and SQl server 2005, can anyone give further help on this issue? I really want to make my app. run on IIS, it ran ok on VS 2005 though. 

    Thanks in advance!

     

     

    Wednesday, December 28, 2005 10:36 AM
  • Dear mw2005,

    Do you have service pack 2 installed on your windows XP? its a requirement for working with SQL Server 2005, to view all the requirements:

    http://www.microsoft.com/sql/editions/express/sysreqs.mspx

    Wednesday, December 28, 2005 12:40 PM
  • Hi, DennisCIS,

    Yes, I have xp SP2 installed, I had to install it first before I can install VWD 2005.  I may have missed something, it didn't work for me.

    Regards,

    mw2005

     

     

    Thursday, December 29, 2005 5:57 AM
  • Anyone made it work under IIS 5.x + XP SP2 environment? or do I have to upgrade to Windows 2003 Server env.?

    One interesting thing is that I changed my application to use "Local impersonation", the error of "Failed to generate a user instance of SQL Server ... " is gone, but I got the other error instead as follows, I still didn't make it run on IIS 5.x + XP SP2 environment, I ran out of ideas now, if anyone could give a helping hand, it'd be very much appreciated.

     

    Object reference not set to an instance of an object.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    Line 13: 			SiteMapNode temp;
    Line 14: 			temp = SiteMap.CurrentNode.Clone(true);
    Line 15: 			Uri u = new Uri(e.Context.Request.Url.ToString());
    Line 16: 			temp.Url += u.Query;
    Line 17: 			if (temp.ParentNode != null) {

    Source File: c:\my_apps\test1\Global.asax    Line: 15

     

     

    Thursday, December 29, 2005 10:15 PM
  • Were you able to resolve this?  I am running into the same problem. I am using the personal site starter kit for VS2005 Express running on PWS on XP sp2.  Any assitance you can offer would be appreciated.  Thanks.  My email is: igaydos @ ptd dot net
    Sunday, February 19, 2006 5:02 PM
  • I had this problem with the Commerce Starter Kit, running XP SP2. I changed the connection strings for both the SQLExpress DBs by setting the User Instance=False (was true). This sorted it out for development... I'll probably get into trouble with deployment like earlier in this thread, but I'll cross that bridge when I get there.
    Wednesday, March 8, 2006 6:07 AM
  • I've had to add new line to my connection string in web.config file to fix the problem:

    <connectionStrings>
      <remove name="LocalSqlServer"/>
      <add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>

    Then the  IIS application pool I used an acount that has a local user profile (local system is an example) but this could make a security hole in your system.

    Hope this was helpful

    Wednesday, March 8, 2006 8:16 AM
  • FYI:  I get this error when the other computer on my home network (2 computers total) is turned on.  It works fine when the other computer is turned off.  This other computer is not used remotely (or in any way) with my SQL Server Express / VB 2005 Express application.
    Monday, March 20, 2006 3:57 PM
  • Ok... more steps, but an overall better solution:

    Current Process:
    What ASP.NET 2.0 does by default with application settings is create SQLExpress database within the App_Data folder of the application.

    If you look closely at the default connection string (LocalSqlServer), it actually attempts to dynamically attach the .mdf to the SQLExpress instance (.\SQLExpress). That is just plain stupid from a security and infrastructure standpoint. Not only will you need to use impersonation if you have IIS Authentication set to Anonymous only (which you have to use roles and users anyway!), but that user must have administrative rights in SQLExpress and on your local box. And that doesn't even bring in troubleshooting the procedure if something fails in the attaching or creating of the database. It is a nightmare that has caused me to re-install VS2005, SQLExpress and the .NET Framework to clear.

    One Solution:
    So, what's the alternative? Since all applications will use the same database, why not just create it yourself, instead of dynamically attaching it. That way you can give the ASPNET account the permissions to access the aspnetdb database without being able to do everything else (good security alternative). Also, you'll take the whole complicated attaching process out of the mix.

    How do you do this? Well, this is what I did on Win XP running SQLExpress and VS2005 prof:

    Change ASP.NET settings

    1) Open up the iis mmc (Administrative Tools > Internet Information Services) and either right click on Default Web Site (if you want this to apply to all current and future web apps) or on the specific web app with the problem.
    2) Choose the ASP.NET tab (make sure the version begins with 2) and click Edit Configuration.
    3) On the General tab, change the LocalSqlServer connection string to:
      data source=.\SQLEXPRESS;Integrated Security=SSPI;initial catalog=aspnetdb
    4) On the Application tab, make sure you are NOT using impersonation. Check that the Local Impersonation checkbox is cleared (which it is in the default installation).

    Create and Configure the aspnetdb for use with ASP.NET

    1) To create the database, you need to choose the Visual Studio 2005 command prompt (under Visual Studio Tools menu).
    2) On the commandline, type aspnet_reqsql. This will launch a wizard. Keep clicking next. The only setting you might have to adjust is the instance name under the Select the Server and Database step. If you have any other instance of SQLExpress or SQL 2000/2005 installed, then you could use that, but then you'd have to change your ASP.NET LocalSqlServer connection string.
    3) When it is done, it will create the aspnetdb database on your SQL instance. Now, you need to configure the ASPNET account for accessing and writing to it.
    4) Open SQL Server Management Studio (if you don't have it, then download the client tools for SQL Server 2005) and create a new login for the ASPNET account.
    5) Expand the Security directory and then right-click on the Logins to create a new Login
    6) Type in ASPNET as the login name (keep Windows Auth selected)
    7) On the User Mappings page, give the ASPNET account full access (check all of the roles if you like) to the aspnetdb database.

    Then, you're done. You shouldn't have to restart anything, but iis can always use it. Start->Run, then iisreset will do the trick. Now, you have a permanent db installed in SQLExpress (or SQL Server 2000/2005 with some adjustment) with the least ammount of privilege given to the ASP.NET process.

    This setup is also a lot easier to debug later! I hope that helps.


    Tuesday, March 28, 2006 12:58 PM
  • I have same problem.
     
    I get the same error message as above. I also tried reinstalling VS2005 and .net framework 2.0.
     
    But I do not see ASPNET User under Documents and Settings !
     
    This is a new problem. Before this problem started I could see ASPNET User under Documents and Settings.
     
    Please help.
    Tuesday, February 6, 2007 10:28 AM
  • Hi guys,

    I went through all your suggestions, but didn't try anything. But I just had a moment of brightness and saw that it was having problems with the roles of the users. So I just went in and added <identity impersonate= "True" /> in the web config. It works smoothly now.

    Regards,

    Liku Zelleke.

    Wednesday, April 9, 2008 1:20 PM
  • I found a solution here. I am not sure if this is your problem!

    http://www.differentpla.net/content/2006/01/failed-to-generate-a-user-instance-of-sql-server
    Monday, July 7, 2008 2:20 PM
  • Most of you are giving the wrong advice for: 

    "Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed. "

     

    There is an easy fix, you just delete a folder under "Documents And Settings" depending on which way your asp.net is configured to run:  As a file system application, or as a Local IIS application.

     

    See here:

     

    http://blogs.msdn.com/joestagner/archive/2008/03/12/sql-express-failed-generate-a-user-instance.aspx?CommentPosted=true#commentmessage

     

    - Bud Sodalsky

    Friday, July 11, 2008 1:00 PM
  • Hi guys,

    I went through all your suggestions, but didn't try anything. But I just had a moment of brightness and saw that it was having problems with the roles of the users. So I just went in and added <identity impersonate= "True" /> in the web config. It works smoothly now.

    Regards,

    Liku Zelleke.

    Hi,you are alsolutely right!
    if you seted a password for your OS
    just add <identity impersonate="True" userName="SystemUserName" password="SystemPassword" /> 
    Best Regards
    Liubing
    Friday, July 31, 2009 11:25 AM
  • I've had to add new line to my connection string in web.config file to fix the problem:

    <connectionStrings>
      <remove name="LocalSqlServer"/>
      <add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>

    Then the  IIS application pool I used an acount that has a local user profile (local system is an example) but this could make a security hole in your system.

    Hope this was helpful


    Thanks Dennis, It's work for me!
    • Proposed as answer by Kendall Cable Sunday, August 23, 2009 1:46 PM
    Tuesday, August 18, 2009 9:37 AM
  • OK for those using hosted SQLServer or remote sql machine, and find that the above does not work for you, here is the fix as far as i understand it.

    you must have a connectionString called LocalSqlServer, it is used by default  perhpase from the membership provider.
    this  connection string, must also point to your sqlserver database instance.


    So placing the following in your <connectinstrings> path will solve the problem:


    <remove name="LocalSqlServer"/>
      <add name="LocalSqlServer" connectionString=CONNECTIONSTRING_TO_YOUR_REMOTE_SQL_SERVER_INSTANCE_HERE"/>



    And replacing the "CONNECTIONSTRING_TO_YOUR_REMOTE_SQL_SERVER_INSTANCE_HERE" with the path that you use to connect to the sqlserver database will do the trick.



    • Proposed as answer by Kendall Cable Sunday, August 23, 2009 1:52 PM
    Sunday, August 23, 2009 1:52 PM
  • Simply put this on your connection string to resolve this problem:
    User Instance=False ---Did not work using Web Developer Express 2008 in Window std server 2008,+ SQL Server 2008
    As a quick fix to this problem, I impersonated as an admin, like <identity impersonate="true" userName="UserWithAdminRight" password="PasswordStrong"/>. You may like to read this article "http://mvolo.com/blogs/serverside/archive/2007/12/08/IIS-7.0-Breaking-Changes-ASP.NET-2.0-applications-Integrated-mode.aspx"
    Wednesday, January 13, 2010 12:39 PM
  • Hello I need help finding were to put the code in my web.config file.

    <configuration>
      
    	<configSections>
    		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    				<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    					<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
    					<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    					<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    					<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    				</sectionGroup>
    			</sectionGroup>
    		</sectionGroup>
    	</configSections>
    	<appSettings />
    	<connectionStrings />
    	<system.net>
        <mailSettings>
          <smtp deliveryMethod="PickupDirectoryFromIis" from="Todays Space Pictures Support">
            <network defaultCredentials="false" host="smtpout.secureserver.net"
              password="website" userName="support@todaysspacepictures.com" />
          </smtp>
        </mailSettings>
      </system.net>
      <system.web>
        <!-- 
                Set compilation debug="true" to insert debugging 
                symbols into the compiled page. Because this 
                affects performance, set this value to true only 
                during development.
            -->
    		<compilation debug="true">
    			<assemblies>
    				<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    				<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    				<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    			</assemblies>
    		</compilation>
    		<!--
                The <authentication> section enables configuration 
                of the security authentication mode used by 
                ASP.NET to identify an incoming user. 
            -->
    		<authentication mode="Forms" />
    		<!--
                The <customErrors> section enables configuration 
                of what to do if/when an unhandled error occurs 
                during the execution of a request. Specifically, 
                it enables developers to configure html error pages 
                to be displayed in place of a error stack trace.
    
            <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
            -->
    		<pages>
    			<controls>
    				<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    				<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    			</controls>
    		</pages>
    		<httpHandlers>
    			<remove verb="*" path="*.asmx" />
    			<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    			<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    			<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
    		</httpHandlers>
    		<httpModules>
    			<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    		</httpModules>
    	</system.web>
    	<system.codedom>
    		<compilers>
    			<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    				<providerOption name="CompilerVersion" value="v3.5" />
    				<providerOption name="WarnAsError" value="false" />
    			</compiler>
    			<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    				<providerOption name="CompilerVersion" value="v3.5" />
    				<providerOption name="OptionInfer" value="true" />
    				<providerOption name="WarnAsError" value="false" />
    			</compiler>
    		</compilers>
    	</system.codedom>
    	<!-- 
            The system.webServer section is required for running ASP.NET AJAX under Internet
            Information Services 7.0.  It is not necessary for previous version of IIS.
        -->
    	<system.webServer>
    		<validation validateIntegratedModeConfiguration="false" />
    		<modules>
    			<remove name="ScriptModule" />
    			<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    		</modules>
    		<handlers>
    			<remove name="WebServiceHandlerFactory-Integrated" />
    			<remove name="ScriptHandlerFactory" />
    			<remove name="ScriptHandlerFactoryAppServices" />
    			<remove name="ScriptResource" />
    			<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    			<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    			<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    		</handlers>
            <defaultDocument>
                <files>
                    <add value="index.aspx" />
                </files>
            </defaultDocument>
    	</system.webServer>
    	<runtime>
    		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    			<dependentAssembly>
    				<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
    				<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
    			</dependentAssembly>
    			<dependentAssembly>
    				<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
    				<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
    			</dependentAssembly>
    		</assemblyBinding>
    	</runtime>
    </configuration>
    
    Thursday, January 21, 2010 1:47 AM
  • If nowadays you are experiencing this problem with windows 2008 server then probably your problem is with default application pool identity. Set the identity of the application pool to the service account NETWORK SERVICE to resolve this issue.

    http://support.microsoft.com/default.aspx/kb/2002980

     

    Friday, January 22, 2010 12:45 PM
  • I did the same thing and it works okay

    I am only not sure what the security impact is of changing the application pool identity to local system.

    Does anyone know about this?

    Arjen

    Monday, April 5, 2010 2:28 PM
  • I have Windows 7 Ultimate, Visual Studio 2008 SP1 and SQL Express 2005 installed and I'm experiencing the problem described by the topic creator. I start the Website in IIS and everything goes well in the Web browser. Then I open it with VS and from View tab I open the Server Explorer and open the default database ASPNETDB.mdf and then I refresh the page in the browser and get this error:

    Cannot open user default database. Login failed.
    Login failed for user 'IIS APPPOOL\Test'.

    I have an Application Pool created named Test.

    The only way I can get pass this is if I go in Task Manager and kill the process sqlservr.exe from my username. Then I go in the browser, refresh the page and everything goes fine.

    I tried many different approaches but none worked in the same way like this one, it has an erratic behaviour. It seems that a sqlserver process fails to close properly.

    Also I can get this error if I go in IIS and select my Website and open .Net Users and then go in the browser and refresh the page and sometimes can't open the .Net Users and receiving about 3 different types of errors saying that the database can't be opened.

    Hope this helps, maybe Microsoft can fix this :P

     

     

    Tuesday, May 18, 2010 2:19 PM
  • Nothing worked for me. I tried below:

    1. Changing User Instance=True to False on web.config.

    2. Deleting SQL Express folder under my profile

    3. Running SQL Express as LocalSystem account

    I have tried above in all permutations and tried rebooting machine.

    I am not sure what to do. I did not know adding a database to my website would be this hard.

    I have read people blocked by this issue for months, and people constantly are giving uninformed advices to solve this issue, which does not seem to do anything.

    Also, another issue / question I have is, I already have SQL Server which is full featured product / superset of SQL Express, yet Visual Studio requires me to install SQL Express on my machine. Why is that? Afterall, isn't SQL Express a subset of SQL Server?

    Patrick

     

     

    Thursday, August 12, 2010 12:40 AM
  • OK for those using hosted SQLServer or remote sql machine, and find that the above does not work for you, here is the fix as far as i understand it.

    you must have a connectionString called LocalSqlServer, it is used by default  perhpase from the membership provider.
    this  connection string, must also point to your sqlserver database instance.


    So placing the following in your <connectinstrings> path will solve the problem:


    <remove name="LocalSqlServer"/>
      <add name="LocalSqlServer" connectionString=CONNECTIONSTRING_TO_YOUR_REMOTE_SQL_SERVER_INSTANCE_HERE"/>



    And replacing the "CONNECTIONSTRING_TO_YOUR_REMOTE_SQL_SERVER_INSTANCE_HERE" with the path that you use to connect to the sqlserver database will do the trick.
    That worked for me



    Wednesday, February 9, 2011 11:54 AM
  • Hi,

    I installed a software that automatically installed SQL Express 2005. When it was done and I launched the program, it came up with error as below. Please help me. Thanks.

    ------------------------------

    Server Error in '/' Application.

    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.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: 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.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [SqlException (0x80131904): 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.]
       System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1096
       System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +103
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +101
       System.Data.SqlClient.SqlConnection.Open() +137
       DataAccess.Open() +60
       DataAccess..ctor() +153
       Start..ctor() +106
       ASP.start_aspx..ctor() +14
       __ASP.FastObjectFactory_app_web_yujjrwvo.Create_ASP_start_aspx() +20
       System.Web.Compilation.BuildResultCompiledType.CreateInstance() +62
       System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +121
       System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +31
       System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +62
       System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +195
       System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +120
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157
    



    Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET Version:2.0.50727.5456

    Monday, January 2, 2012 2:26 AM
  • Hi,

    I installed a software that automatically installed SQL Express 2005. When it was done and I launched the program, it came up with error as below. Please help me. Thanks.

    ------------------------------

    Server Error in '/' Application.

    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.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: 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.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [SqlException (0x80131904): 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.]
       System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1096
       System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +103
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +101
       System.Data.SqlClient.SqlConnection.Open() +137
       DataAccess.Open() +60
       DataAccess..ctor() +153
       Start..ctor() +106
       ASP.start_aspx..ctor() +14
       __ASP.FastObjectFactory_app_web_yujjrwvo.Create_ASP_start_aspx() +20
       System.Web.Compilation.BuildResultCompiledType.CreateInstance() +62
       System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +121
       System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +31
       System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +62
       System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +195
       System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +120
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157
    



    Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET Version:2.0.50727.5456

    Old post. posting solution for anyone revisiting.
    Appears to be a known issue. See http://support.microsoft.com/kb/2002980 

    This posting is provided “AS IS” with no warranties, and confers no rights.

    If this reply answers your question, please mark it as Answered for others to find it easily.
    If this reply help you resolving the problem, please vote the post as Helpful.

    Wednesday, September 12, 2012 9:09 AM