【发布时间】:2015-02-10 21:39:29
【问题描述】:
我已经使用 Async 和 Await 实现了一种 ActionMethod,结果是 Task
[Route("Newdiaries/NewTestAsync")]
public async Task<ActionResult> Index()
{
var countryId = Nationalizator.CurrentCountryId;
var cultureCode = DomainCulture.Current.LCID;
var channel = GetCandidateServiceChannel("WSHttpBinding_ICandidateService");
IndividualPersonalInformationDto res = await channel.GetNewIndividualPersonalInformationAsync(new Guid("31764EC2-663D-C996-DB46-08D11B0047E5"), countryId, cultureCode).ConfigureAwait(false);
var model = new MyTestModel
{
Name = res.BusinessId
};
return View("NewTestIndex",model);
}
它正在抛出 System.Threading.Tasks.Task1[System.Web.Mvc.ActionResult]`。
我正在使用 Visualstudio 2012 和 .Net 4.5 框架。请帮忙。
【问题讨论】:
-
有什么异常?
-
System.Threading.Tasks.Task不是一个例外,而是一个类。 -
好的,我没有得到部分视图渲染,而是显示这条消息:
-
我的问题是它显示的不是渲染部分视图结果:System.Threading.Tasks.Task`1[System.Web.Mvc.ActionResult]
-
@PradeepKumar:你确定你使用的是 ASP.NET MVC 4?
标签: asp.net-mvc-4 async-await c#-5.0