Testing Facebook Credits with ASP.NET

I ran into some issues attempting to test Facebook Credits with ASP.NET locally during development. I have an MVC3 site that is running in the Azure Development Environment and I wanted to be able to test the credits functionality. I played around with a bunch of settings, etc. and finally got a combination of things working that allows me to test credits locally. Below are the steps I took:

1. Set the web project as the startup project in the Visual Studio solution. Unless you need specific Azure functionality this is much easier since Azure does not want to accept traffic from anything other than localhost and credits testing will not work with localhost.

2. Set your web project to run using IIS or IIS Express bound to http://localhost. (Project Properties -> Web -> Servers) If you want to use IIS Express and have IIS installed you will need to unbind the default web site from port 80. ** I also had to stop the Web Deployment Agent Service as it binds to port 80.

3. I used DynDns.com to provide a host name for my web site and entered this as the domain for both the Canvas Url and Credits Callback Url. The Credits callback will not work with or localhost so you need some external domain. I tried using a made up entry in my HOSTS file but Facebook needs a real address since they initiate the request for the callback.

4. I edited the applicationHost.config file under %userprofile%documentsiisexpress to allow my DynDns name like so (system.applicationHost/sites node):


<site name=”WebAppName” id=”1″>

                <application path=”/” applicationPool=”Clr4IntegratedAppPool”>

                    <virtualDirectory path=”/” physicalPath=”DirToWeb” />



                    <binding protocol=”http” bindingInformation=”*:80:localhost” />

                    <binding protocol=”http” bindingInformation=”*:80:dyndnsname” />




5. Do any port forwarding on your router and enable port 80 on your firewall.

6. Setup the callback code according to the Facebook Docs, I even used the JS sample code to test.