Reputation: 29159
I replaced the auto-created aspnet-myproject-20130130223621.mdf
and it's ldf files with the files from another project. It didn't work so I deleted these two files and hope the Asp.Net can re-create these two files. I always get the following error Exception in the following function.
Exception on:
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
// Ensure ASP.NET Simple Membership is initialized only once per app start
LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
}
Exception message:
{"Exception has been thrown by the target of an invocation."}
InnerException message:
{"Cannot attach the file 'c:\users\nick\documents\visual studio 2012\Projects\MyProject\MyProject\App_Data\aspnet-MyProject-20130130223621.mdf' as database 'aspnet-MyProject-20130130223621'."}
Upvotes: 1
Views: 2896
Reputation: 4568
Open up your SQL Server Management studio and connect to LocalDB. You'll see that your Database is still there. Delete it from there and .NET will re-generate your database again.
Upvotes: 2