Monday, March 21, 2011

Deploy Your Facebook Application in Azure

Hi All,
If you trying to get started developing Facebook Applications in C#, Then you need to download facebook SDK in C#, and you can get the latest build from below link:
After you install Facebook SDK, You will have good samples to get started and configure your application to be integrated with Facebook. After you will be able to successfully configure the first application. Then, If you want to deploy this application on Windows Azure, The question will be: How Can i deploy a sample website into Azure ? All samples provided in FB SDK are ASP.NET websites. As you might know, To deploy any web role in Azure you need to have a Web Application and Not a website. So the question how can i do this ? Please follow these steps:
1) Create a new Web Application in your solution.
2) Copy the Web.Config that you have in FB website and paste it in your web application.
3) Copy the code in Global.asax in FB Web site and paste it in your web application Global.asax.
4) You need to copy the code in FB web site master page and have it in your web application master page with updates to couple of controls.
5) Copy the code in web site default.aspx and paste it in your web application default.aspx.
6) Make sure to add latest Facebook.dll and Facebook.web.dll in your ASP.NET web application.
7) You need Facebook.MVC.dll if your application is a MVC ASP.NET application.
8) Make sure to update your web application web.config with the Facebook configuration.
9) Try to build and run your web application. You will be directed to facebook canvas page as configured in your web application.
10) Add a cloud service in your solution.
11) Add this web application as a web role and try to set the cloud service as a startup project.
Note: Make sure to target 4.0 .NET Framework.
Build & Test it out !
Hope this helps.
Mostafa Arafa

No comments: