Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ken Cowley 10 posts 29 karma points
    Jun 04, 2013 @ 16:36
    Ken Cowley
    0

    MVC 4 not working with Umbraco 4.11.9

    Hi,I'm tryin gmy first test project with Umbraco 4.11.9 and MVC 4.
    I have create the Umbraco site and database all working well.
    Then created a new MVC 4 project and added a controller as shown below

    namespace UmbracoMVCDemo.FrontEnd.Controllers
    {    
        public class DemoSurfaceController : Umbraco.Web.Mvc.SurfaceController    
        {        
            //        // GET: /Demo/        
            public ActionResult Index()        
            {            
                return View();        
            }    
        }
    }


    and added a view

    @{    
        ViewBag.Title = "Index";
    }

    Index
    This is our own Demo controller and View.


    When running the site it never its the break point in the controller.
    What have I missed here with regads to routing which I assumed was automatic.
    I tried adding a documenttype call demo and associatyed template but nothing.
    The url is was using is http://localhost:/DemoAll I get is a blank page,
    if I use a RenderMvcController I can get it to work but its not what I want.

    Any help apprciated this is my first week with Umbraco MVC

    Thanks

    Ken

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jun 04, 2013 @ 19:02
    Jan Skovgaard
    0

    Hi Ken

    Have you changed the template engine in /config/umbracoSettings.config to MVC? By default it's webforms.

    /Jan

  • Ken Cowley 10 posts 29 karma points
    Jun 05, 2013 @ 08:52
    Ken Cowley
    0

    Hi,

    Yes first thing I did was change the config to <defaultRenderingEngine>MVC</defaultRenderingEngine>.

    As I said if I use RenderMvcController instead of SurfaceController I can get it toi hit the breakpoint so the routing works.

    I just can seem to get it to work with the code above and can't seem to find a good whole example that I can look at to see where I'm going wrong.

    Thanks

    Ken

  • Ken Cowley 10 posts 29 karma points
    Jun 05, 2013 @ 12:37
    Ken Cowley
    0

    Ok managed to get the routing working now but get a different error

    Attempt by method 'Login' to access method 'System.Web.Mvc.Controller.PartialView(System.String, System.Object)' failed.

    One step at a time

    Ken

     

     

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 05, 2013 @ 13:27
    Dave Woestenborghs
    0

    You should call your sufarce controller action from a view with @Html.Action

  • Ken Cowley 10 posts 29 karma points
    Jun 05, 2013 @ 13:45
    Ken Cowley
    0

    Yep done that this is my front page view

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = null;
    }
    
    @Html.Action("Index","DemoSurface")
    
  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 06, 2013 @ 10:47
    Dave Woestenborghs
    0

    I think the problem is that you don't specify a view for action in your controller :

    Can you try this : 

    return PartialView("YourViewName");

     

  • Ken Cowley 10 posts 29 karma points
    Jun 06, 2013 @ 15:57
    Ken Cowley
    0

    Well it looks like the issue was my project being MVC 4 and not MVC 3. If I use MVC 3 it all works fine if I use MVC 4 I get errors.

    Will have to look at Umbraco version 6.x to see if I can migrate from 4.11.x

    Thanks for tall the help :-)

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 06, 2015 @ 16:34
    Jeroen Breuer
    0

    Hello,

    We're getting the same errors, but with MVC 4 and Umbraco 6. It only happens on 1 environment. Any idea what could be the problem?

    Attempt by method 'Umbraco.Extensions.Controllers.Surface.PartialController.ShowTopMenu()' to access method 'System.Web.Mvc.Controller.PartialView(System.String, System.Object)' failed.

    Jeroen

  • Charles Afford 1163 posts 1709 karma points
    May 07, 2015 @ 13:56
    Charles Afford
    0

    Hi guys,

    What routing do you have in place.

    I thought I had seen this before with IIS, it was something stupid like having basic auth and another turned on. I will try and find what it was.

    Ken can you post your code and also are you using IIS or webmatrix?

    Could you post what the app pool settings are like if you are using .net4.5 ect :).

    Thanks,

    Charlie

Please Sign in or register to post replies

Write your reply to:

Draft