[Mono-aspnet-list] Mono Asp.NET MVC 4 and async actions

Daniel J. Summers daniel.summers.2415 at gmail.com
Wed Apr 3 17:18:20 UTC 2013


According to
http://msdn.microsoft.com/en-us/library/system.web.mvc.asynccontroller(v=vs.108).aspx
,
the "AsyncController" only exists for backwards compatibility with MVC 3.
 "Controller" in MVC 4 implements the Async patterns itself.  You should be
good to go with just the signature change on your action.  You might also
want to try the the async keyword (.NET 4.5) on your signature - "public
async Task<ActionResult> Index()", although the compiler will issue a
warning if you don't have at least one "await" statement within the
controller.  If you're not awaiting anything, your controller itself isn't
really async, although returning the task lets the framework sleep until
the controller is done with its logic.

(Not sure whether that's the problem or not; I'm not at a place where I can
verify it.  But, it would help to isolate the change that's breaking, and
if it fixes it, you'd be on your way.)


On Wed, Apr 3, 2013 at 5:57 AM, Ventsislav Mladenov <
ventsislav.mladenov at gmail.com> wrote:

> HI, all
>    Today I tried to use async actions under Mono 3.0.6, I changed one
> action method which works correctly to async action:
> Change Controller to AsyncController
> Change action declaration from:
>
> public ActionResult Index  to
> public Task<ActionResult> Index
>
> And now I'm getting error:
> System.InvalidOperationExceptionThe view 'Index' or its master was not
> found or no view engine supports the searched locations. The following
> locations were searched: ~/Areas/Reports/Views/Activities/Index.aspx
> ~/Areas/Reports/Views/Activities/Index.ascx
> ~/Areas/Reports/Views/Shared/Index.aspx
> ~/Areas/Reports/Views/Shared/Index.ascx ~/Views/Activities/Index.aspx
> ~/Views/Activities/Index.ascx ~/Views/Shared/Index.aspx
> ~/Views/Shared/Index.ascx ~/Areas/Reports/Views/Activities/Index.cshtml
> ~/Areas/Reports/Views/Activities/Index.vbhtml
> ~/Areas/Reports/Views/Shared/Index.cshtml
> ~/Areas/Reports/Views/Shared/Index.vbhtml ~/Views/Activities/Index.cshtml
> ~/Views/Activities/Index.vbhtml ~/Views/Shared/Index.cshtml
> ~/Views/Shared/Index.vbhtml
>
> *Description:* HTTP 500.Error processing request.
>
> *Details:* Non-web exception. Exception origin (name of application or
> object): System.Web.Mvc.
> *Exception stack trace:*
> at System.Web.Mvc.ViewResult.FindView (System.Web.Mvc.ControllerContext
> context) [0x00000] in <filename unknown>:0 at
> System.Web.Mvc.ViewResultBase.ExecuteResult
> (System.Web.Mvc.ControllerContext context) [0x00000] in <filename
> unknown>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult
> (System.Web.Mvc.ControllerContext controllerContext,
> System.Web.Mvc.ActionResult actionResult) [0x00000] in <filename unknown>:0
> at
> System.Web.Mvc.ControllerActionInvoker+<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17
> () [0x00000] in <filename unknown>:0 at
> System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter
> (IResultFilter filter, System.Web.Mvc.ResultExecutingContext preContext,
> System.Func`1 continuation) [0x00000] in <filename unknown>:0
>
> The project is on .net 4.0 and uses asp.net mvc 4
>
> Then I tried the code under MS.NET and it works.
>
>
> _______________________________________________
> Mono-aspnet-list mailing list
> Mono-aspnet-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-aspnet-list
>
>


-- 
*Daniel J. Summers*
*Owner, DJS Consulting*
E-mail <daniel.summers.2415 at gmail.com> • Website <http://djs-consulting.com>
 • Support <http://support.djs-consulting.com> • Tech
Blog<http://techblog.djs-consulting.com>

E-mail <daniel.summers.2415 at gmail.com> • Social Media and
Blogs<http://about.me/daniel.j.summers>

"Who is more irrational? A man who believes in a God he doesn't see, or a
man who's offended by a God he doesn't believe in?" — Brad Stine

GEEKCODE 3.12 GCS/IT d s-:+ a C++ P--- L++ E--- W++ N++ o? K- w !O M--
V PS+ PE++ Y? PGP- t+ 5? X+ R* tv b+ DI++ D+ G- e<++ h---- r+++ y++++
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20130403/8e6e8212/attachment.html>


More information about the Mono-aspnet-list mailing list