0

私は得ています

XMLHttpRequest はhttp://myurl.com/RestServiceImpl.svc/postを読み込めません。オリジンhttp://myurl2.comは Access-Control-Allow-Origin で許可されていません。WCF Rest で記述された Post サービスの呼び出し中のクライアント Javascript アプリでのこのエラー

私のサービス

[OperationContract]
        [WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Wrapped,
            UriTemplate = "post")]
        bool JSONDataPost(string Value);


public bool JSONDataPost(string Value)
        {   //code to Create the Person goes here

            return true;
        }

そして私のクライアントの要求は

var xhr = new XMLHttpRequest();
    xhr.open('POST', 'http://myurl.com/RestServiceImpl.svc/post', true);
    xhr.setRequestHeader("Content-Type", "application/jsonp;charset=UTF-8");
    xhr.onload = function () {
        // do something to response

    console.log(this.responseText);
    };
    xhr.send(JSON.stringify("TEST"));
4

0 に答える 0