title: C# Web Service won't output JSON, only XML
body: <p>I'm trying to use jQuery and JSON with a C# Web Service that I wrote. No matter what, the following code will only output in XML.</p>
  
  <p><strong>Webservice Code</strong></p>
  
  <pre><code>[WebMethod]
  [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
  public string HelloWorld() {
      return "Hello World!";
  }
  </code></pre>
  
  <p>I also have these attributes assigned to the class</p>
  
  <pre><code>[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  [ScriptService]
  </code></pre>
  
  <p><strong>jQuery Code</strong></p>
  
  <pre><code>$.ajax({
      type: "POST",
      contentType: "application/json; charset=utf-8",
      url: "ScheduleComputerDS.asmx/HelloWorld",
      data: "{}",
      dataType: "jsonp",
      success: function(data) {
          alert(data);
      }
  });
  </code></pre>
  
  <p>The ASMX page always returns as content type "text/xml". Anything I'm missing?</p>
  
  <p><strong>EDITS:</strong> In response to a couple answers:</p>
  
  <p>If I have the datatype as just "json" the content is still XML and jQuery also will not call my callback function. If I add the "&amp;callback=?" to the url, IIS throws a HTTP 500 error.</p>
  
  <p>My class does inherit from "System.Web.Services.WebService". </p>
  
  <p>From doing some research on your guys answers, it looks like I do need to mess with WCF. Unfortunately the JSON that is returned is more designed for MS Ajax and is a lot of useless bloat for my use. I may look into an open source library like Jayrock or something similar.</p>
  
  <p>Thanks for all your help!</p>