With SQL Server Express, i had 2 different databases in the App_Data folder of an application, and i was getting constant connection errors.

After googling, i tried any solution, from changing cacls on the db folder, adding users in the sql server security, database roles, to changing identity of the iis application pool, and so on...

NOTHING Worked !

Even with 1 database alone, i was getting errors if the database was opened at the same time in visual studio and by IIS...

I ended up by regrouping the 2 databases in one,
and attached it the classic way to the server through sql server management studio.

with this connection

<

add name="mydatabase" connectionString="Server={host name}\SQLExpress;Trusted_Connection=yes;Database={Database name}"></add>