Book Image

ServiceStack 4 Cookbook

Book Image

ServiceStack 4 Cookbook

Overview of this book

Table of Contents (18 chapters)
ServiceStack 4 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Testing external service callbacks locally using Fiddler2 and IIS Express


Some providers will not accept localhost as a callback URL, which can make testing external services difficult. Other problems with local networks could also cause various problems when trying to test callbacks locally. In this appendix, you are going to set up a workaround that can help when working with a specified call-back URL.

You want to provide either a URL for an existing development server/environment or a URL you are going to redirect to your local machine for testing. If you don't have a development server to deploy to, and want to test it locally, put it in http://localdev.<websiteurl>/, where <websiteurl> might be your production domain or a temporary name used only for testing. It can be any valid URL, but to avoid problems, you want to avoid locally redirecting a real URL.

The following instructions are for local development with IIS Express:

  • If not already installed, download and install the Fiddler2 tool, which will be used to redirect, allowing you to test your local site as shown in the following screenshot:

  • Go to Tools | HOSTS and tick Enable remapping of requests, specifically from the localdev URL provided to Twitter and localhost (of the example application), as shown in the following screenshot:

  • Update IIS Express applicationhost.config file to accept requests pointing to any host name. The applicationhost.config file should be located in your local user's My Documents/IISExpress/config directory. Find the <site> entry in applicationhost.config for the example application. If it's missing, try running the application using IIS Express. Update HTTP's bindingInformation *:<port>:*. For example:

    <site name="Recipe2" id="471">
      <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\projects\service-stack-book\src\Chapter 7\Recipe2\Recipe2\Recipe2" />
      </application>
      <bindings>
        <binding protocol="http" bindingInformation="*:54511:*" />
      </bindings>
    </site>
  • Restart IIS Express and keep Fiddler2 running to handle remapping.