title: WCF REST Service Template 40(CS) Cross domain error
body: <p>Hi I have a WCF Rest service using ( WCF REST Service Template 40(CS)). I have managed to get it to return Json response. It is working fine when the project is run. But when I try to make a Ajaxcall to the service  from the browser, I am getting Error:</p>
  
  <blockquote>
    <p>Cross-Origin Request Blocked: The Same Origin Policy disallows reading
    the remote resource at <code>http://192.168.0.70:8001/Service/test</code>.
    This can be fixed by moving the resource to the same domain or
    enabling CORS.</p>
  </blockquote>
  
  <p>And The Ajax call:</p>
  
  <pre><code>$.ajax({
          type: "POST",
          url: "http://192.168.0.70:8001/Service/test",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          async: true,
          cache: false,
          success: function (msg) {
          var Tabels = msg.d;
          alert('success');
          }
      });
  </code></pre>
  
  <p>Here is the web.config:</p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;
      &lt;configuration&gt;
        &lt;connectionStrings&gt;
  
          &lt;add name="ConString" connectionString="SERVER=localhost;DATABASE=fabapp;UID=root;PASSWORD=;"/&gt;
        &lt;/connectionStrings&gt;
        &lt;system.web&gt;
          &lt;compilation debug="true" targetFramework="4.0" /&gt;
        &lt;/system.web&gt;
  
        &lt;system.webServer&gt;
  &lt;httpProtocol&gt;
        &lt;customHeaders&gt;
          &lt;add name="Access-Control-Allow-Origin" value="*" /&gt;
        &lt;/customHeaders&gt;
      &lt;/httpProtocol&gt;
          &lt;modules runAllManagedModulesForAllRequests="true"&gt;
            &lt;add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /&gt;
          &lt;/modules&gt;
        &lt;/system.webServer&gt;
        &lt;system.serviceModel&gt;
          &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true"/&gt;
          &lt;standardEndpoints&gt;
            &lt;webHttpEndpoint&gt;
              &lt;!-- 
                  Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
                  via the attributes on the &lt;standardEndpoint&gt; element below
              --&gt;
              &lt;standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="false" defaultOutgoingResponseFormat="Json"/&gt;
            &lt;/webHttpEndpoint&gt;
          &lt;/standardEndpoints&gt;
        &lt;/system.serviceModel&gt;
  
      &lt;/configuration&gt;
  </code></pre>
  
  <p>I tried adding crossDomainScriptAccessEnabled="true" but when I do that the service does not work on the localhost also. I get this: </p>
  
  <blockquote>
    <p>Cross domain javascript callback is not supported in authenticated
    services.</p>
  </blockquote>
  
  <p>Anything I need to change in web.config file?</p>