Как добавить Access-Control-Allow-Origin?
Я получаю следующую ошибку при вызове метода webservice.
Origin http://localhost:4165 is not allowed by Access-Control-Allow-Origin.
При обращении в сеть я получаю решение как добавитьAccess-Control-Allow-Origin
Я не знаю, где добавить это. Мой сценарий:
$(document).ready(function () {
$.ajax({
type: "Post", dataType: "json", contentType: "application/json; charset=utf-8",
url: "http://localhost:63384/ListWebService.asmx/HelloWorld", success: function (data) { alert(data.d); }, error: function (request, status, error) {
alert(request.responseText);
}
});
});
И мой метод веб-сервиса:
[WebMethod]
public string HelloWorld()
{
return "Hello User";
}