Last post Feb 27, 2014 06:28 AM by gliba008
Feb 25, 2014 08:27 AM|gliba008|LINK
Hello everybody, we have a problem with deployment of our MVC web app to IIS server.
My Web.Config looks like this:
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-GO-20140108065711.mdf;Initial Catalog=aspnet-GO-20140108065711;Integrated Security=True" providerName="System.Data.SqlClient" />
My DbContext looks like this:
public class AppContext : IdentityDbContext<User>
public AppContext() : base("DefaultConnection")
The problem is that there is no Execude Code First Migrations checkbox (see the picture):
thank you for your help
Feb 26, 2014 09:12 PM|Angie xu - MSFT|LINK
Thanks for your feedback in asp.net forum.
According to your description above, it's recommended to enable Code First Migrations first.
The Migrations feature enables you to change the data model and deploy your changes to production by updating the database schema without having to drop and re-create the database.
Please follow this tutorial to do Code First Migrations and deployment with
the Entity Framework in an ASP.NET MVC application first.
If it still has same issue, please let me know.
Feb 27, 2014 06:28 AM|gliba008|LINK
Hello Angie and thank you for your reply.
I have enabled migrations and everything was well, but then suddenly the error described above started.
I tried to find the couse for this and it was errors in my code.
To be exact, I included Elmah.Mvc package in my MVC 5 project. That package was stopping Entity framework from working well. I noticed that scaffolding of new Controllers and views was not working and it gave me some strange errors. I removed Elmah.Mvc package
and then it gave me errors that entity framework doesn't understand what elmah means in Web.Config file.
I cleaned Web.Config file from all elmah stuff and then included ordinary Elmah package and everything worked well.