Csla.DataPortalException: DataPortal.Fetch failed

Csla.DataPortalException: DataPortal.Fetch failed

Old forum URL: forums.lhotka.net/forums/t/7629.aspx


ludwigs3rd posted on Tuesday, September 15, 2009

I haven't gotten a chance to read much of the CSLA... 2008 C# book (I just got it a week or so ago) so maybe someone can point me to the proper section in the book or help me fix this in the ProjectTracker sample. I have it running locally (no wcf) but wanted to see how it works with WCF. So I setup the WCFHost project to point to the MDF files provided and am hosting WCFHost in IIS 7.0 under Vista-64. I can access the service via the browser just fine. I configured the PTWin app.config to point to that IIS Hosted WCFHost and I get that error shows in the subject. Here is a little snippet:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
Csla.DataPortalException: DataPortal.Fetch failed (An attempt to attach an auto-named database for file C:\Users\Me\Documents\Visual Studio 2008\Projects\ProjectTrackercs\Security.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.) ---> Csla.Reflection.CallMethodException: DataPortal_Fetch method call failed ---> System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file C:\Users\Me\Documents\Visual Studio 2008\Projects\ProjectTrackercs\Security.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
etc...
I appreciate any help anyone can offer.

RockfordLhotka replied on Tuesday, September 15, 2009

The exception is indicating that Security.mdf can't be found. I think the SQL Server Express exception could be better phrased, but that's a Microsoft thing obviously :)

You probably need to edit your app.config or web.config to have the correct path to the mdf file.

ludwigs3rd replied on Wednesday, September 16, 2009

Thanks again for the advice Rocky, even for this trivial issue! :)

Copyright (c) Marimer LLC