Cannot recreate SQL Server Express database with Entity Framework Code First and MVC 3 without changing database name

When I run the application with the next connection string, the database file is created successfully.

<add name="ConnString1"
     connectionString="Data Source=.\SQLEXPRESS;
                       Database=Database1;
                       Integrated Security=SSPI;
                       AttachDBFilename=|DataDirectory|aspnetdb.mdf;
                       User Instance=true"
     providerName="System.Data.SqlClient" />

If I delete the database file and try to run the application again, the database file will not be created, and I will receive the following internal exceptions:

Invalid base provider at opening.
{"Unable to open the database \" Database1 \ "requested at login. Login failed. \ Database1 \ nLogin failed for user \\ someuser '." }

If I changed Database = Database1 to Database = Database2 in the connection string, then the database file will be created successfully. The problem always recurs.

?

+5
2

, mdf, / - mdf - , -

+1

, - , - .

-, db - , , . - - EdmMetadata - , -. , , , , .

, , - , .

, (, ), , , . , db .

- .

0

All Articles