C# 异步wcf服务返回null

C# 异步wcf服务返回null,c#,wcf,asynchronous,C#,Wcf,Asynchronous,您好,我正在创建一个异步WCF服务,并在HTML应用程序中使用它,但每次我都从服务中得到null。我是异步方法的新手,请指导我,我在这里分享我的代码: Service.cs public static async Task<string> GetTJSON() { string responseData = string.Empty; using (var httpClient = new HttpClient()) { us

您好,我正在创建一个异步WCF服务,并在HTML应用程序中使用它,但每次我都从服务中得到null。我是异步方法的新手,请指导我,我在这里分享我的代码:

Service.cs

public static async Task<string> GetTJSON()
{
 string responseData = string.Empty;
        using (var httpClient = new HttpClient())
        {
            using (var response = await httpClient.GetAsync("http://api.xyz.com/json/feeds?system=apios").ConfigureAwait(false))
           {
                responseData = await response.Content.ReadAsStringAsync();
                return responseData;
            }
        }
}

public async Task<string> getJ()
    {
        var json = await GetTJSON();
        return json.ToString();
}
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "GetJsonNet1", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
Task<string> getJ();

数据是否为空?或者只是
result
为空?您可以看到等待
GetTJSON
是否会产生预期的结果吗?它不会返回到getJ()函数。它在wait httpClient.GetAsync向html发送响应,然后处理并执行其余代码,所以我得到的结果是null
data
null?或者只是
result
为空?您可以看到等待
GetTJSON
是否会产生预期的结果吗?它不会返回到getJ()函数。它在wait httpClient.GetAsync处向html发送响应,然后处理并执行其余代码,所以我得到的结果为null
var GetJsonNet = function () {
        $.ajax({
            type: "GET",
            url: "http://localhost:59835/Service1.svc/GetJsonNet1",
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            success: function (data) {
                var result = data.GetEmployeeJSONResult;
                console.log(result);
                var obj = $.parseJSON(result);
                alert('s:' + obj);
            },
            error: function (xhr) {
                alert('e:'+xhr.responseText);
            }
        });
    }