Ho un regolatore di"System.Threading.Tasks.Task`1 [System.Web.Mvc.ActionResult]" invece di vista
public class InvitationController : Controller
{
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Create(InvitationModel invitationmodel)
{
if (ModelState.IsValid)
{
var regLink = _repo.SaveAndGetRegistrationLink(invitationmodel);
IEMailer mailer = new EMailer();
var inv = mailer.Invitation(invitationmodel.Email, regLink);
await Task.WhenAll(new AsyncEmailSender().SendEmail(inv));
return RedirectToAction("Index");
}
return View(invitationmodel);
}
}
Funziona bene sul mio localhost (reindirizza a una pagina desiderata dopo aver inviato l'e-mail). ho pubblicato il mio sito web per smarterasp.net
E ora si vede una stringa invece di reindirizzamento:
System.Threading.Tasks.Task`1[System.Web.Mvc.ActionResult]
Qual è la ragione, e come risolvere il problema?
Elmah non ha registrato nulla. L'email è stata effettivamente inviata.
Ho provato ad aggiungere MVC dll. Tutti i file sottostanti si trovano accanto alla mia dll del sito.
- System.Web.Mvc
- Microsoft.Web.Infrastructure
- System.Web.Razor
- System.Web.WebPages
- System.Web.WebPages.Razor
- sistema. Web.Helpers
modificare
amministratore Host mi ha mandato un registro da IIS:
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
StackTrace: at System.Web.ThreadContext.AssociateWithCurrentThread(Boolean setImpersonationContext)
at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)
at System.Web.LegacyAspNetSynchronizationContext.CallCallbackPossiblyUnderLock(SendOrPostCallback callback, Object state)
at System.Web.LegacyAspNetSynchronizationContext.CallCallback(SendOrPostCallback callback, Object state)
at System.Web.LegacyAspNetSynchronizationContext.Post(SendOrPostCallback callback, Object state)
at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.PostAction(Object state)
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.Tasks.AwaitTaskContinuation.<ThrowAsyncIfNecessary>b__1(Object s)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Hai pubblicato 'System.Web.Mvc.dll'? Sembra che il server stia utilizzando una versione precedente. – SLaks
Ho provato - la stessa cosa – gisek
Quale versione di .NET, ASP.NET e ASP.NET-MVC? –