Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用ajax调用调用WCF Rest服务时始终获得空响应_C#_Jquery_Ajax_Wcf_Rest - Fatal编程技术网

C# 使用ajax调用调用WCF Rest服务时始终获得空响应

C# 使用ajax调用调用WCF Rest服务时始终获得空响应,c#,jquery,ajax,wcf,rest,C#,Jquery,Ajax,Wcf,Rest,这可能是一个非常常见的问题,但我无法通过互联网解决它。首先让我介绍一下这个问题,, 我有一个Rest WCF服务,如下所示: // Service operation that retrieves the KPI result [OperationContract] [WebInvoke(Method = "GET", RequestFormat=WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json,

这可能是一个非常常见的问题,但我无法通过互联网解决它。首先让我介绍一下这个问题,, 我有一个Rest WCF服务,如下所示:

   // Service operation that retrieves the KPI result
    [OperationContract]
    [WebInvoke(Method = "GET", RequestFormat=WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Wrapped,
        UriTemplate = "/KPI/{monthYear}/{currentYear}/{companyCode}/{divisionCode}/{shopCode}/{parameterName}/{kpiCode}")]
    int Get_SY_KPI(string monthYear,string currentYear,string companyCode, string divisionCode, string shopCode, string parameterName, string kpiCode);
我试图通过一个简单的ajax调用从html表单调用此服务:

$.ajax({
            type: "GET",
            url: "http://localhost:5547/FoxWcfRest.svc/KPI/March/2014/001/001/003/END_QUANTITY_INDICATOR_HP/002",           
            contentType: "application/json; charset=utf-8",
            success: function(response) {

                alert(response);

            },
            error: function()
            {
                alert("Oops");
            }
        });

我不确定出了什么问题,但我收到了空警报消息,我读到了一些关于跨域问题的信息。。有人能帮忙吗?

这只是个打字错误。。还有同样的问题如果在服务方法中添加调试断点并执行ajax请求,调试断点会触发吗?@NeilThompson否我添加了一个断点,结果是ajax请求不会触发它..更新:从IIS管理器中删除项目目录后,我能够命中断点,但没有成功的结果。。