title: Return jsonp from self hosted WEB API Console app
body: <p>I've use the jsonp formatter described in this blog post: <a href="http://www.west-wind.com/weblog/posts/2012/Apr/02/Creating-a-JSONP-Formatter-for-ASPNET-Web-API" rel="nofollow">http://www.west-wind.com/weblog/posts/2012/Apr/02/Creating-a-JSONP-Formatter-for-ASPNET-Web-API</a></p>
  
  <p>Has anybody tried using the formatter with a self hosted console application?</p>
  
  <p>I've tried the formatter in a regular MVC 4 project, and it worked immediately. However, I would like to use it in a self hosted console application, and I've had a lot of trouble getting it to work.</p>
  
  <p>I've registered the formatter, and verified that it is added:</p>
  
  <pre><code>var config = new HttpSelfHostConfiguration(serviceUrl);
  
  config.Formatters.Insert(0, new JsonpMediaTypeFormatter());
  </code></pre>
  
  <p>I have verified that the formatter is being called when I make a request with the following code:</p>
  
  <pre><code>$("#TestButton").click(function () {         
      $.ajax({
          url: 'http://localhost:8082/Api/Test',
          type: 'GET',
          dataType: 'jsonp',
          success: function(data) {
              alert(data.TestProperty);
          }
      }); 
  })
  </code></pre>
  
  <p>I've checked in Fiddler, and the response I get is:</p>
  
  <pre><code>HTTP/1.1 504 Fiddler - Receive Failure
  Content-Type: text/html; charset=UTF-8
  Connection: close
  Timestamp: 09:30:51.813
  
  [Fiddler] ReadResponse() failed: The server did not return a response for this request.
  </code></pre>
  
  <p>I'd be really grateful if anybody can shed some light on what is going on!</p>
  
  <p>Thanks,</p>
  
  <p>Francis</p>