How to migrate existing ASP.NET MVC 3 Project with .MDF file (Sql 2008) to Windows Azure Emulator (using SQL Azure)

前端 未结 1 478
情书的邮戳
情书的邮戳 2021-02-11 08:57

I have existing project in Visual Studio 2010, ASP.NET MVC 3 with existing database using .mdf (SQL 2008 Express). After doing some googling, I got confused because there are so

1条回答
  •  时光说笑
    2021-02-11 09:08

    First of all it is large question and you will have to work in parts to get everything done. The following steps are written with understanding that you do have Windows Azure subscription and have basic understanding of ASP.net, MVC, SQL and VS2010.

    Step 1: Install Windows Azure SDK 1.6 http://go.microsoft.com/fwlink/?LinkID=234939&clcid=0x409

    Step 2: After that, open your MVC3 application and when you right click on solution you will find a new option as "Add Windows Azure Deployment Project", select it.

    You will see a new Windows Azure project is created in your solution name your_application_name.Azure (default) is created. At this time if you make Azure project as your "Startup" application and run it, your MVC3 application will run inside Windows Azure Compute Emulator. Lets the SQL server related code intact and your code actually will work with existing SQL server.

    Step 3: Verify your code for any problem and fix it. Be sure to test in Compute Emulator and this is the time please learn about Service Configuration and Service Definition with your Windows Azure project.

    Step 4: Once you have your MVC3 application working in compute emulator, go ahead and just replace SQL server to SQL Azure. Follow the step by step details here:

    http://msdn.microsoft.com/en-us/hh285881

    Step 5: Once your SQL Azure is configured you just (ONLY) need to change your Connect String in web.config, pointing to SQL Azure.

    http://msdn.microsoft.com/en-us/library/windowsazure/ee336282

    Step 6: Now if you run your MVC3 application in Compute Emulator, you can verify that it does connect to SQL Azure and verify all is well.

    Step 7: Finally now package your application and deploy to Windows Azure for deployment and final test. The step by step details are located here:

    http://msdn.microsoft.com/en-us/spazuretrainingcourse_introtowindowsazurelabvs2010_topic4#_Toc297905245


    Step 0: If you have time I would suggest you to finish this exercise first as described in the link below to understand most of the basic information about MVC, ASP.NET Web Role, SQL Azure and Deployment process: https://www.windowsazure.com/en-us/develop/net/tutorials/web-app-with-sql-azure/

    0 讨论(0)
提交回复
热议问题