I followed Ido Flatow's post to create a cross-origin request and created the following:
On my service interface:
[OperationContract]
[WebInvoke(Method = "*", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
bool GetUserAuthentication(string userLoginName, string password);
On app.config:
<behaviors>
<endpointBehaviors>
<behavior name="webSupport">
<webHttp />
<CorsSupport />
</behavior>
</endpointBehaviors>
</behaviors>
<extensions>
<behaviorExtensions>
<add name="CorsSupport" type="WebHttpCors.CorsSupportBehaviorElement, WebHttpCors, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
Now I'm sending a simple post request using angular $http service and it's working on IE & Edge (also on Postman) but fails to work on Chrome & Firefox with the following error:
XMLHttpRequest cannot load http://localhost:5280/MetaDataService/GetUserAuthentication. Response for preflight has invalid HTTP status code 400
Chrome error printscreen: