cannot attach file (for database) when hooking up to EF context

I am trying to use a typed EF datacontext. I have never been able to create the connection. Here is what I have and what I am doing:

I have my Git repository in C:\Users\gregv\Source\Repo...
I am using the latest EF (not EF Core). My DbContext class is in squashspider.dll.

So I click on Add connection and it brings up the dialog box
I select the second radio button ("Use a typed data context from your own assembly")
I select Entity Framework (DbContext V4/V5/V6)
I hit Next.

I click on Browse to select the squashspider.dll (its in my bin directory)
I leave "via the parameterless constructor" selected.

if I click on Test then it times out.

So I select choose on the "path to the app config file" and select my WebConfig file

Then when I select test, I get the following error (much quicker than the time out)

"An error occurred processing the request

SqlException: Cannot attach the file 'C:\Program files(x86)\LINQPad5\SquashSpiderDB.mdf" as database 'aspnet-SquashSpider-XXX'

of course there is no file at that location. Or is it supposed to be creating a file at that location?

I thought it might be because I am not running LINQPad as administrator and it is trying to create a file in a restricted area.

So I ran it as admin and it did get further. Now I get the error:

"SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Named Pipes Provider, error: 0 - No process is on the other end of the pipe)

How are you supposed to hook up to your program's specific DbContext?


Sign In or Register to comment.