Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Creating Database with EF Code first on Azure

I keep getting a Invalid object name when tring to use entity framework code first against a Azure database. It is a MVC 3 project where I created a Model then the Controllers using EF and a new Context. Here is a list of the steps Ive taken to resolve it. I'm hoping I'm missing something obvious.

  1. Download VS 2010 SP1
  2. Download EF 4.1
  3. set up a firewall exception in Azure for my external IP.
  4. set the Connection string shown in Azure in my Web.config
  5. Turn off my firewall to rule this out.

It seems the index page is trying to pull back results, but the solution is not creating the database as it should so there is no database and I get a error occurred while executing the command defintion. Anyone?

like image 735
Jesse Avatar asked Apr 18 '26 02:04

Jesse


1 Answers

We found that it was important that the SQL Azure database did not already exist. EF code first would fail even if we had an entirely empty database.

Try letting EF create the database entirely from scratch.

like image 53
Andy Milligan Avatar answered Apr 21 '26 11:04

Andy Milligan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!