title: CORS implementation showing method not allowed for POST request
body: <p>I am trying to call a WCF service Method using Http POST Request from another Project , it allows GET request but when I try for  POST request it is showing <strong>"Method not allowed"</strong>.</p>
  
  <p>When i tried it shows this error in my Console:</p>
  
  <blockquote>
    <p>Access to XMLHttpRequest at '<a href="http://localhost:7280/api/values/24" rel="nofollow noreferrer">http://localhost:7280/api/values/24</a>' from origin '<a href="http://localhost:6538" rel="nofollow noreferrer">http://localhost:6538</a>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.</p>
  </blockquote>
  
  <p>Web API:
  Method:</p>
  
  <pre><code>[WebInvoke(UriTemplate = "/values", Method = "POST", ResponseFormat = WebMessageFormat.Json), CorsEnabled]
          void AddValue(string value);
  </code></pre>
  
  <p>Method Implementation</p>
  
  <pre><code>public void AddValue(string value)
          {
              string id = nextId.ToString();
              nextId++;
              allValues.Add(id, value);
              string location = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.RequestUri.ToString() + "/" + id;
              WebOperationContext.Current.OutgoingResponse.SetStatusAsCreated(new Uri(location));
          }
  </code></pre>
  
  <p>Client Application:</p>
  
  <pre><code>$("#post").click(function () {
              var data = "\"" + $("#value").val() + "\"";
              $.ajax({
                  url: valuesAddress,
                  type: "POST",
                  contentType: "application/json",
                  data: data,
                  success: function (result) {
                      $("#result").text(result);
                  },
                  error: function (jqXHR, textStatus, errorThrown) {
                      $("#result").text(textStatus);
                  }
              });
          });
  </code></pre>
  
  <p>I followed 
  <a href="https://code.msdn.microsoft.com/Implementing-CORS-support-c1f9cd4b/view/SourceCode#content" rel="nofollow noreferrer">https://code.msdn.microsoft.com/Implementing-CORS-support-c1f9cd4b/view/SourceCode#content</a> 
  I created web API and client Application as different projects.
  Please help to solve this issue.</p>