/// <summary> /// 返回到客户端的消息 /// </summary> /// <param name="request"></param> /// <param name="statusCode"></param> /// <param name="message"></param> /// <returns></returns> private Task <HttpResponseMessage> CreateResponse(HttpRequestMessage request, HttpStatusCode statusCode, string message) { BaseJson <string> resultMsg = new BaseJson <string> { Status = (int)JsonObjectStatus.Fail, Message = message, Data = null }; TaskCompletionSource <HttpResponseMessage> tsc = new TaskCompletionSource <HttpResponseMessage>(); HttpResponseMessage response = resultMsg.TryToJson().ToHttpResponseMessage(); //request.CreateResponse(statusCode); //response.ReasonPhrase = message; tsc.SetResult(response); return(tsc.Task); }