jQuery GET到Web服务返回错误200和400

时间:2012-03-13 00:41:21

标签: c# wcf web-services

我有一个带有operationContract的WCF服务;

    [OperationContract]
    [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json)]
    TrainLines GetLines();

火车线路是;

[DataContract]
public class TrainLines
{
    [DataMember]
    public List<string> Name { get; set; }
}

在Web配置中,我将绑定定义为{basicHttpBinding}。

现在我试图通过jquery消耗它,但我得到错误200和400;

        jQuery.support.cors = true;

        $.ajax({
            type: "GET",
            contentType: "application/json; charset=utf-8",
            url: "http:/Domain/WebService/GetLines",
            dataType: "json",
            success: function (msg) {
                ServiceSucceeded(msg);
            },
            error: ServiceFailed
        });

0 个答案:

没有答案