Roman Pelepei gives smart answers on questions about C# .Net, ASP .Net, WPF and Silverlight programming with examples and source code.
понедельник, 17 июня 2013 г.
How do I get migration seed data for a default user with pw and role, which works locally to work when I publish it to Azure?
I have an MVC 4 EF web project with a code-first sql server db that very closely follows the basic and usual structure of any you would see as an example anywhere on the web.
I have read EVERY article posted on the internet concerning how to do what I need and none of them so far make any difference to my situation. I am not doing anything extraordinary, I just took out the 'Register' new user capability as needed by my project, and am trying to create a couple of users as login points by including them in the Migrations/Configuration.cs file like this:
Everything works beautifully locally, but when I publish to my Azure account, where everything is set up properly as near as I can tell, the app appears correctly except that I can't login as my seeded user. I have connected to my Azure db using SQL Management Studio and all of the UserProfile and webpages_ tables are there, the app specific ones are not because the code-first hasn't had a chance to build the yet (I assume), but there are no users or roles. Locally, everything is built and populated as expected.
I have added the often suggested code in the root Web.config file thus: