Note that there are some explanatory texts on larger screens.

plurals
  1. PODeploying MVC 4 CodeFirst to Azure
    text
    copied!<p>I'm trying a 90 day free trial of azure. It is super easy to deploy/publish the website and create the database, but for some reason my tables are not being created in the database. I'm using entity framework 4.4(i believe) and code first migrations. I've read that azure uses its own connection string, but I went ahead and changed my connection strings as well. I Spent hours on this and I can't figure out what is wrong and why my tables are not being created. I deploy website, enable-migrations, add-migration, update-database, then publish with checking the checkbox for code-first. Maybe my connection string is wrong? Any help is greatly appreciated. </p> <p>In 'MyProject.Web' web.config:</p> <pre><code>&lt;configSections&gt; &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt; &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt; </code></pre> <p></p> <pre><code>&lt;connectionStrings&gt; &lt;add name="DefaultConnection" connectionString="Data Source=tcp:n98my***.database.windows.net,1433;Initial Catalog=slutips_db;User Id=****;Password=****;" /&gt; &lt;/connectionStrings&gt; </code></pre> <p>Then in 'MyProject.Data' app.config, where my datacontext.cs is held:</p> <pre><code>&lt;entityFramework&gt; &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&gt; &lt;contexts&gt; &lt;context type="SeluCmpsTutorials.Data.DataContext"&gt; &lt;databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion"&gt; &lt;parameters&gt; &lt;parameter value="slutips_db"/&gt; &lt;/parameters&gt; &lt;/databaseInitializer&gt; &lt;/context&gt; &lt;/contexts&gt; &lt;/entityFramework&gt; </code></pre> <ul> <li>Also I noticed even though all my connection strings are changed, when I add-migration and update-database, it still using the ./sqlexpress local database, how is that possible?</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload