.net 使用AJAX jQuery调用WCF端点时出现问题

.net 使用AJAX jQuery调用WCF端点时出现问题,.net,ajax,wcf,jquery,jsonp,.net,Ajax,Wcf,Jquery,Jsonp,我有一个WCF 3.5服务,我需要使用jQuery作为跨域调用来调用它,当我调用该服务时,我返回了正确的响应,但jQuery抛出了异常parsererror状态 这是我用来调用WCF服务的代码 <script type="text/javascript"> $(document).ready(function () { var wordlist = $("#main-container").text() $.ajax({

我有一个WCF 3.5服务,我需要使用jQuery作为跨域调用来调用它,当我调用该服务时,我返回了正确的响应,但jQuery抛出了异常parsererror状态 这是我用来调用WCF服务的代码

<script type="text/javascript">
    $(document).ready(function () {
        var wordlist = $("#main-container").text()


        $.ajax({
            type: "GET",
            contentType: 'application/json; charset=utf-8',
            url: 'http://192.168.1.210:8080/XXXX.SPServices/GlossaryService.svc/GetWordsWithDifenition',
            dataType: 'jsonp',
            data: { 'stringwords': wordlist },
            success: function (data) {
                PutLinkToDefinition(data);
            },
            error: function (jqXHR, textStatus, errorThrown) {
                debugger;
            }
        });
    });

</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using Microsoft.SharePoint.Client.Application;
using Microsoft.SharePoint.Client;
using System.Net;
using System.Configuration;

namespace XXXX.SPServices
{
    [ServiceContract(Namespace = "")]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

    public class GlossaryService
    {
        // To use HTTP GET, add [WebGet] attribute. (Default ResponseFormat is WebMessageFormat.Json)
        // To create an operation that returns XML,
        //     add [WebGet(ResponseFormat=WebMessageFormat.Xml)],
        //     and include the following line in the operation body:
        //         WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml";
        [OperationContract]
        [WebGet]
        public Dictionary<string,string>  GetWordsWithDifenition(string stringwords)
        {
            ......
        }



}

$(文档).ready(函数(){
var wordlist=$(“#主容器”).text()
$.ajax({
键入:“获取”,
contentType:'application/json;charset=utf-8',
网址:'http://192.168.1.210:8080/XXXX.SPServices/GlossaryService.svc/GetWordsWithDifenition',
数据类型:“jsonp”,
数据:{'stringwords':单词列表},
成功:功能(数据){
PutLinkToDefinition(数据);
},
错误:函数(jqXHR、textStatus、errorshown){
调试器;
}
});
});
jQuery调用error函数并抛出此错误

jQuery161074459453323911_1309093997517 没有人打电话来

这是我的WCF服务

<script type="text/javascript">
    $(document).ready(function () {
        var wordlist = $("#main-container").text()


        $.ajax({
            type: "GET",
            contentType: 'application/json; charset=utf-8',
            url: 'http://192.168.1.210:8080/XXXX.SPServices/GlossaryService.svc/GetWordsWithDifenition',
            dataType: 'jsonp',
            data: { 'stringwords': wordlist },
            success: function (data) {
                PutLinkToDefinition(data);
            },
            error: function (jqXHR, textStatus, errorThrown) {
                debugger;
            }
        });
    });

</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using Microsoft.SharePoint.Client.Application;
using Microsoft.SharePoint.Client;
using System.Net;
using System.Configuration;

namespace XXXX.SPServices
{
    [ServiceContract(Namespace = "")]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

    public class GlossaryService
    {
        // To use HTTP GET, add [WebGet] attribute. (Default ResponseFormat is WebMessageFormat.Json)
        // To create an operation that returns XML,
        //     add [WebGet(ResponseFormat=WebMessageFormat.Xml)],
        //     and include the following line in the operation body:
        //         WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml";
        [OperationContract]
        [WebGet]
        public Dictionary<string,string>  GetWordsWithDifenition(string stringwords)
        {
            ......
        }



}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用System.Runtime.Serialization;
使用System.ServiceModel;
使用System.ServiceModel.Activation;
使用System.ServiceModel.Web;
使用系统文本;
使用Microsoft.SharePoint.Client.Application;
使用Microsoft.SharePoint.Client;
Net系统;
使用系统配置;
命名空间XXXX.SPServices
{
[ServiceContract(名称空间=”)]
[AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
公共类词汇服务
{
//要使用HTTP GET,请添加[WebGet]属性。(默认响应格式为WebMessageFormat.Json)
//要创建返回XML的操作,
//添加[WebGet(ResponseFormat=WebMessageFormat.Xml)],
//并在操作体中包含以下行:
//WebOperationContext.Current.OutgoingResponse.ContentType=“text/xml”;
[经营合同]
[WebGet]
公共字典GetWordsWithDifenition(字符串单词)
{
......
}
}
这是标记

<%@ ServiceHost Language="C#" Debug="true" Service="XXXX.SPServices.GlossaryService" CodeBehind="GlossaryService.svc.cs"  Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>


非常感谢您的帮助。

WCF 3.5不支持跨域调用/JSONP开箱即用。您必须升级到或选中。

WCF 3.5不支持跨域调用/JSONP开箱即用。您必须升级到或选中