Asp.net mvc 4 async/await返回异常Threading.Tasks.Task`1[System.Web.Mvc.ActionResult]异常

Asp.net mvc 4 async/await返回异常Threading.Tasks.Task`1[System.Web.Mvc.ActionResult]异常,asp.net-mvc-4,async-await,c#-5.0,Asp.net Mvc 4,Async Await,C# 5.0,我用Async和Wait实现了一个ActionMethod,结果是Task [Route("Newdiaries/NewTestAsync")] public async Task<ActionResult> Index() { var countryId = Nationalizator.CurrentCountryId; var cultureCode = DomainCulture.Current.LCID; var channel = GetCand

我用Async和Wait实现了一个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);
}
[路由(“新日记/newestasync”)]
公共异步任务索引()
{
var countryId=Nationalizator.CurrentCountryId;
var cultureCode=DomainCulture.Current.LCID;
var通道=GetCandidateService通道(“WSHttpBinding_ICandidateService”);
IndividualPersonalInformationDto res=等待频道。GetNewIndividualPersonalInformationAsync(新Guid(“31764EC2-663D-C996-DB46-08D11B0047E5”)、countryId、cultureCode)。配置等待(false);
var模型=新的MyTestModel
{
Name=res.BusinessId
};
返回视图(“NewTestIndex”,模型);
}

它正在抛出
System.Threading.Tasks.Task
1[System.Web.Mvc.ActionResult]`


我正在使用Visualstudio 2012和.Net 4.5框架。请帮助。

我认为问题在于您正在从HttpContextThread切换,请尝试删除.configureWait(false),我认为它将解决您的问题:)

什么是异常?
System.Threading.Tasks.Task
不是异常,而是一个类。好的,我没有得到部分视图渲染,而是显示以下消息:我的问题不是呈现它显示的部分视图结果:System.Threading.Tasks.Task`1[System.Web.Mvc.ActionResult]@PradeepKumar:您绝对确定使用的是ASP.NET Mvc 4吗?