Home  /  Questions  /  Question



55   94.7
Sep 03, 2010


Patterns in Action 4.0 data access issue

Hi,
I have a database access issue. I tried everything to run the Patterns in Action 4 application, but cannot get it to work.
The error I get is: 'failed to create user instance'.  I have SQL Express 2005. Can someone please help?

Thanks
Viv



50   50
Sep 27, 2010
Hi, I got same proplem today but got it fixed pretty fast. I just renamed C:\Documents and Settings\xxxxxx\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS folder and restarted SQL servers service. with regards, Antti

830   99.9
Sep 06, 2010
Vivek:

In the documentation, specifically the Patterns in Action 4.0 pdf on page 15 and up you'll find the necessary instructions on how to use SQL Server, rather than SQL Express.

Hope this helps.

55   94.7
Sep 04, 2010
Hi Dan,

Thanks for the advice. I tried what you mentioned but it does not seem to be working. Let me give you the environment I am working on.

Stand alone laptop with Windows 7 (ultimate ediition).
SQL server 2008 developer edition
Sql serverr 2008 R2 Express edition (removed now)
Sql server 2005 Express edition with SP2
Visual studio 2010 ultimate edition

I made a small change in WCF application app config for localsqlserver to point SQL server 2008 developer edition (where i have aspnetdb). So now atleast the login part is working. But failing at GetCustomers in Model.cs with the error message 'The underlying provider failed to open'. There is a image of error attached with this post.

I tried to attach Action.mdf and aspnetdb.mdf to both the sql server instances and it failed.

Basically I am trying to point at the databases in SQL Server Developer Edition instead of attaching at runtime.
Can you give me some suggesstions where to make changes in the config files?

Thanks
Viv




830   99.9
Sep 03, 2010
Vivek:

I am sorry for the trouble.  This is the first time we see this issue reported within the context of Patterns in Action 4.0.  So, I would suggest that you not change anything in web.config in the Pattern in Action application.

I did some Googling and Binging and found that there does not seem to a single reason / solution to this problem.  The best discussions may be these threads:

http://social.msdn.microsoft.com/Forums/en/sqldatabaseengine/thread/f5eb164d-9774-4864-ae05-cac99740949b

http://forums.asp.net/p/1377174/3427619.aspx

In no particular order, these threads offer the following suggestions: 

1) Modify the SQL Server (SQLExpress) service to use your local or system account and restart the service.

2) ensure you are logged in as an Administrator

3) explore the error log in the following directoryremove the following directory and then restart your machine (username is usually ASPNET)

  C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS
     or on Vista / Windows 7
  C:\Users\username\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

4) remove the above mentioned directory entirely and then restart your machine. 
    Please note these are suggestions only, we cannot guarantee any outcome (good or bad).

I hope this helps.

 1 comment
 
Hi Dan, Thanks for the advice. I tried what you mentioned but not working. Let me give you the environment I am working on. Stand alone laptop with Windows 7 (ultimate edition). SQL server 2008 developer edition Sql server 2008 R2 Express edition (removed now) Sql server 2005 Express edition with SP2 Visual studio 2010 ultimate edition I made a small change in WCF application app config for localsqlserver to point SQL server 2008 developer edition (where i have aspnetdb). So now atleast the login part is working. But failing at GetCustomers in Model.cs with the error message 'The underlying provider failed to open'. There is a image of error attached with this post. I tried to attach Action.mdf and aspnetdb.mdf to both the sql server instances and it failed. Basically I am trying to point at the databases in developer edition instad of attaching at runtime. Please give me some suggesstions where to make changes in the config files. Thanks Viv --- Vivek Bhat  Sep 04, 2010