I have implemented one of the ActionMethod with Async and Await and result is Task < ActionResult >
[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);
}
It is throwing the System.Threading.Tasks.Task
1[System.Web.Mvc.ActionResult]` .
I am using Visualstudio 2012 and .Net 4.5 Framework. Please help.
我认为问题是您正在从HttpContextThread切换,请尝试删除.ConfigureAwait(false),我认为它将解决您的问题:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.