No se pudo agregar Access-Control-Allow-Origin a mi proyecto de biblioteca WCF
Estoy tratando de entender por qué este ajax llamado no funciona
$.ajax({
type: 'GET',
url: "http://localhost:8732/Design_Time_Addresses/InMotionGIT_NT.Address.Service/AddressService/json/capitalize",
data: { streetAddress : JSON.stringify(streetAddress) , consumer : JSON.stringify(consumer)} ,
datatype: "jsonp",
success: function (data) {
$('body').append('<div>'+data.IDblah+' '+ data.prueba+'</div>');
alert(data.IDblah);
}
El servicio que recibe los datos se recibe correctamente y la respuesta es correcta. ¿Por qué estoy haciendo mal?
Intenté agregar esta propiedad al ajax llamado pero sin éxito.crossDomain : true
[OperationContract()]
[WebInvoke(Method="GET", RequestFormat=WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json)]
public string Capitalize(StreetAddress streetAddress,ConsumerInformation consumer)
El error que recibo es lo común.
XMLHttpRequest cannot load Origin http://localhost:50816 is not allowed by Access-Control-Allow-Origin.
ACTUALIZAR
Intenté agregar el encabezado a la respuesta agregando la configuración en miApp.config
archivo pero sin éxito
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>