今日碰到這樣的問題 ,接口回調的值可以打印出來。但是js回調里面顯示為空 ,接口處於等待狀態,
public async Task<IEnumerable<string>> Get(string s)
{
Log.InfoFormat(ITCloudLogType.common, "Begin Request.thread id:{0},time:{1},requestId:{2}", Thread.CurrentThread.ManagedThreadId, DateTime.Now.ToLongTimeString(), this.ControllerContext.Request.GetCorrelationId().ToString());
await Task.Run(()=>Job1(s));
Log.InfoFormat(ITCloudLogType.common, "End Request.id:{0},time:{1},requestId:{2}", Thread.CurrentThread.ManagedThreadId, DateTime.Now.ToLongTimeString(), this.ControllerContext.Request.GetCorrelationId().ToString());
return new string[] { "value1", "value2" };
}
private void Job1(string s)
{
return;
}
private int Job2()
{
return 2;
}
