Today I had to fight one small, but highly annoying problem. It is related to Entity Framework and SQL Server connection string. When you create a .edmx file with your model, the wizard automatically inserts proper connection string to your app.config or web.config file. Well, it is not always correct string.
In my case, I have .edmx file in a class library and it worked fine when I was using it from WinForms application. But then I decided to put it on a web site. And it ceased to work. The only thing I could get from it was
SQL Server 2005 SQLExpress error: …provider: Named Pipes Provider, error 40 - Could not open connection to SQL Server
I tried many things, but in the end it turned to be some mistreatment of a connection string. Mine looks this way:
The problem goes away when I put a backslash instead of slash in “./SQLEXPRESS”. It looks pretty weird, because they always used forward slash in such autogenerated connection strings, didn’t they?
P.S.: Sorry about connection string being image here. :-)