我有一个带有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
});