Skip navigation

In the recent ASP.NET MVC refresh we introduced a new template — the Facebook Template. You can create Facebook App from it easily. I believe there are articles introducing the template, for example this post from Yao. In following post, I’d like to go through how to host a Facebook App in Windows Azure Web Site

I assume you’ve already read the tutorial and begin with build your App from the template, you shall eventually be able to run your App locally. You probably is still using IIS Express without SSL turning on. You’re using Local DB and the database is fulfilled with random data your generated during test.

Secure Canvas URL

There is a couple of things you may want to prepare locally.

First you need to ensure your application can run under SSL. Although Facebook allows you not to host your web site under SSL when it is in sandbox mode, you have to leave sandbox once your App is open to publish. As a result, Facebook will hit your secure canvas URL.

You can tried out SSL easily on your local machine by enable SSL.

Enable SSL

After that you should fill the SSL URL in Facebook App Setting

Update Secure Canvas URL

Now run your App. The iFrame will load page from HTTPS URL. If you’re using IE, you will see a warning. That is because IIS Express’s certificate is not trusted. I will discuss the topic in another post, but for now you can simple click “Show all content” to continue.

If your app works find at this point, your secure canvas URL preparation is done.

Upload your site to Azure Web Site

Azure Web Site was added in June 2012. For all of the options provided in Windows Azure to host web site, I like Azure Web Site the most. It is simple, light and powerful enough to deal with most of the cases.

Here’s a tutorial of how to create an Azure Web Site. Remember Facebook App is also an MVC web application. So instead of creating an Internet Application, you create a Facebook Application.

The rest of the part are largely the same. The tutorial publish the sites through Visual Studio Web Deploy and it works great. However, my favorite is publishing a website with Git.

Manage your App secret

Facebook App Secret is the common secret shared between your App and Facebook. You don’t want it to be compromised. But if that happens, you can reset the App Secret.

App Secret Reset

To update your secret to your App is extremely easy in Windows Azure Web Site. You don’t need to change web.config, you don’t need to redeploy. What your need to do is in the Azure Web Site’s CONFIG page

Config Tab

Find the app setting and update Facebook:AppSecret

Appsettings

About these ads

One Comment

  1. Amazing a lot of beneficial info.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: