Home  /  Questions  /  Question

50   50
Aug 05, 2010

Attaching SQL Server in Design Pattern Framework

I attached both the ASPNETDB.mdf and Action.mdf to my local SQLServer instance and modified the Web.config for Host.WCF.ActionServer and App.Config for DataObjects\App.Config but I get this error when I click on Products link:

+  $exception {"The underlying provider failed on Open."} System.Exception {System.Data.EntityException}

Is there anywhere else I need to change the connection string?


820   99.9
Aug 05, 2010
Hi Sunit: 

The problem is your connectionstring to the ASPNETDB.sql.   Membership uses an implicit connectionstring (to ASPNETDB.SQL under \App-Data). So, by moving this database to SQL Server you also need to adjust this under the Membership section in web.config. 

I suggest that you not directly attach the local SQL Express databases to SQL Server, but instead do it in the following 2 steps (that is, one database at a time).

STEP 1) Migrating the Action database.

1) Create a brand new database on SQL Server, called Action.
2) Run Action.sql script to create the tables and the data (this file is under Solution Items\Sql Server\Action.sql)
3) Adjust the entries in web.config (according to the documentation. Note: the connectionstrings are already in place)

Then run.

At this point you are still using the local ASPNETDB.sql membership database.

STEP 2)  You can also migrate the ASPNETDB database like so: 

1) Create a brand new database on SQL Server, called ASPNETDB
2) Run Aspnetdb.slq script which creates the membership schema and user entries.
3) Adjust the Membership section in web.config (here is an example of how to do this: http://www.studiocoast.com.au/knowledgebase/article-6-aspnet-using-sql-server-instead-of-aspnetdbmdf.aspx

Then run.

Hopefully, this gets you going.