I have an ASP.NET 3.5 app with a SQL 2005 Express .mdf database file in its App_Data folder. Lets call that Foo.mdf. On its own the ASP.NET app can connect to the database with no problems. So far so good.
Then, if I install Sql Server Management Studio Express on the server and start it, it finds the local SQLEXPRESS instance and connects to it, but doesn't show Foo.mdf in the list of databases.
So I try and Attach Foo.mdf by right-clicking on databases and selecting Attach.. and finding the .MDF. This fails with a vague error:
CREATE FILE encountered operating system error 32(error not found)
while attempting to open or create the physical file
'C:\inetpub\wwwroot\FooApp\App_Data\Foo.mdf'. (Microsoft SQL Server, Error: 5123)
If I stop my ASP.NET site in IIS, then the attach does work, but then when I restart my ASP.NET app, it can't connect to Foo.mdf.
So it looks like SQL Express 2005 will only let either my app or Management Studio connect. This seems really crap - surely Sql Express should allow more than one connection? I was expecting it to behave like regular Sql Server.
Hopefully I'm doing it wrong. Please advise.