Back to list
Views:   17.8K
Replies:  4

Patterns in Action 4.0 data access issue

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?

Vivek Bhat, Sep 03, 2010
Reply 1
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
Antti Kajanus, Sep 27, 2010
Reply 2

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.
Dan McMillan, Sep 06, 2010
Reply 3
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?


Vivek Bhat, Sep 04, 2010
Reply 4

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:

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.

Dan McMillan, Sep 03, 2010
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.