locked
Problem with Code First Migrations RRS feed

  • Question

  • User539650680 posted

    Hi,

    I deployed mvc application in Azure just to test web deploy ("Contoso Univercity" from this example http://code.msdn.microsoft.com/ASPNET-MVC-Application-b01a9fe8).

    The solution works fine on the local computer. I used .publishSettings file from WindowsAzure. Checkbox "Execute Code First Migrations" (in Publish > Settings) was not active. And problem was that all pages (except the home) does not open after publishing.

    Then I made the following:
    1. Updated EntityFramework.
    2. In the Package Manager Console window entered the command "enable-migrations" (then I got "Migrations" folder with Configuration.cs file in it)...
    3. then entered the command "add-migration Initial"...
    4. command "update-database"

    After it Checkbox "Execute Code First Migrations" became active, I checked it and published the project again.
    But the problem was not solved and pages don't open. What am I doing wrong?

    Saturday, September 15, 2012 5:52 PM

All replies

  • Saturday, September 15, 2012 7:01 PM
  • User539650680 posted

    Thank you for this tutorial. I made step by step all the items on this tutorial but with no result. In my version of solution (http://code.msdn.microsoft.com/ASPNET-MVC-Application-b01a9fe8)  I have no amd64 and x86 folders in bin folder, but other items were made as well as tutorial.

    Sunday, September 16, 2012 2:27 AM
  • User1985864055 posted

    Did you build the project and then refresh Solution Explorer and make sure Show All Files is selected?  If you did all that and you really don't have the amd64 and x86 folders, the only other thing I can think of to try for SQL Compact is to uninstall and reinstall the SqlServerCompact NuGet package.  It should set up a post-build copy script for those files.  If all else fails, you could also consider using a SQL Database (formerly SQL Azure) database instead.  You'd have to create the database, get the connection string, and change the connection string in the deployed site to point to that database.  This tutorial shows how to do that:

    http://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/

    Sunday, September 16, 2012 2:19 PM
  • User409112183 posted

    Hi,

    Some of your pages are not opening.  Put break points in the action methods which return those particular views.  Try to debugg from Visual Studio with connection string to your SQLAzure database.  Probably you will get exceptions.  Then you can find out what is going wrong.

    Thursday, September 20, 2012 8:52 AM