문제

You can see the below information about my deployment

  1. AutoMigration= true
  2. I have created a database in server.
  3. I select the deploy option with right click to my project, and select my DB server and database.
  4. It has successfully uploaded and deployed my application.

Here is my connection string after deployment to the server :

 <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=**.***.***.***;Initial Catalog=MyDatB;User ID=sa;Password=*****" providerName="System.Data.SqlClient" />
  </connectionStrings>

And here is my migration config

public Configuration()
{
    AutomaticMigrationsEnabled = true;
    ContextKey = "ModulericaV1.Models.ApplicationDbContext";
}

But i got the following error when i am trying to launch my application :

Migrations is enabled for context 'ApplicationDbContext' but the database does not exist or contains no mapped tables. Use Migrations to create the database and its tables, for example by running the 'Update-Database' command from the Package Manager Console.

Please note : If i did not create my database in development server, my codefirst application is not going to create database for me .. It is also problem i think.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top