Copied to clipboard

Flag this post as spam?

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


  • Jon R. Humphrey 164 posts 455 karma points c-trib
    Aug 01, 2013 @ 10:52
    Jon R. Humphrey
    1

    "The controller for path '/' was not found or does not implement IController" error after upgrade from v6.0.5 to v6.1.3

    After following the standard upgrade path found on Upgrades in general and stepping through the all the configs in the config folder as well as the base web.config AND the views/web.config via WinMerge; I restarted the site profile, opened the site in Chrome, and was walked through the upgrade steps as usual!

    I'm thinking then "YAY this site can go live once I push these changes to the production server and go to bed!!!"

    Once the upgrade completed I went into the back office and republished the entire site just to be on the safe side. I sat back, relaxed and opened the site front end ... to receive a YSOD!

    Server Error in '/' Application.
    
    The controller for path '/' was not found or does not implement IController.
    
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
    Exception Details: System.Web.HttpException: The controller for path '/' was not found or does not implement IController.
    
    Source Error: 
    
    
    Line 41:        }
    Line 42:                <header>
    Line 43:                    @Html.Action("PrepareCallback", "CallbackFormSurface")
    Line 44:                    <p id="helplineCallbackResponse"></p>
    Line 45:                </header>
    
    Source File: e:\sites\WIP\www.lawcare.org.uk\website\Views\Partials\Hotlines.cshtml    Line: 43 
    
    Stack Trace: 
    
    
    [HttpException (0x80004005): The controller for path '/' was not found or does not implement IController.]
       System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +683953
       Umbraco.Web.Mvc.RenderControllerFactory.CreateController(RequestContext requestContext, String controllerName) +162
       System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +305
       System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +87
       System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +41
    
    [HttpException (0x80004005): Execution of the child request failed. Please examine the InnerException for more information.]
       System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +785864
       System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +3977
       System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +275
       System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +94
       System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +700
       System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +123
       ASP._Page_Views_Partials_Hotlines_cshtml.Execute() in e:\sites\WIP\www.lawcare.org.uk\website\Views\Partials\Hotlines.cshtml:43
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
       System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196
       StackExchange.Profiling.MVCHelpers.WrappedView.Render(ViewContext viewContext, TextWriter writer) +295
       System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +158
       Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, Nullable`1 timeout, Func`1 getCacheItem, Object syncLock) +218
       Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, Nullable`1 timeout, Func`1 getCacheItem) +176
       Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, Nullable`1 timeout, Func`1 getCacheItem) +154
       Umbraco.Web.CacheHelperExtensions.CachedPartialView(CacheHelper cacheHelper, HtmlHelper htmlHelper, String partialViewName, Object model, Int32 cachedSeconds, String cacheKey, ViewDataDictionary viewData) +438
       Umbraco.Web.HtmlHelperRenderExtensions.CachedPartial(HtmlHelper htmlHelper, String partialViewName, Object model, Int32 cachedSeconds, Boolean cacheByPage, Boolean cacheByMember, ViewDataDictionary viewData) +428
       ASP._Page_Views_SW_Master_cshtml.Execute() in e:\sites\WIP\www.lawcare.org.uk\website\Views\SW_Master.cshtml:118
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
       System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196
       System.Web.WebPages.WebPageBase.Write(HelperResult result) +89
       System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +233
       System.Web.WebPages.WebPageBase.PopContext() +291
       StackExchange.Profiling.MVCHelpers.WrappedView.Render(ViewContext viewContext, TextWriter writer) +295
       System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +378
       System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +33
       System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854204
       System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854204
       System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
       System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +854256
       System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +40
       System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +15
       System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65
       System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
       System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51
       System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
       System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
       System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
    
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
    

    So here is the offending line 43 of "Hotlines.cshtml":

    @Html.Action("PrepareCallback", "CallbackFormSurface")
    

    And here is the Surface Controller (found in the "App_Code" directory atm):

    using System;
    using System.ComponentModel.DataAnnotations;
    using System.Net.Mail;
    using System.Text;
    using System.Web.Mvc;
    using Umbraco.Web;
    using Umbraco.Web.Mvc;
    
    /// <summary>
    /// Summary description for HotlineController
    /// </summary>
    public class CallbackFormSurfaceController : SurfaceController
    {
    [ChildActionOnly]
    public ActionResult PrepareCallback()
    {
        TempData.Clear();
    
        return PartialView("CallbackForm", new CallbackFormModel
        {
            CallbackHeadline = CurrentPage.AncestorOrSelf(1).GetPropertyValue<string>("callbackHeadline"),
            CallbackPlaceholder = CurrentPage.AncestorOrSelf(1).GetPropertyValue<string>("callbackPlaceholder"),
            CallbackTooltip = CurrentPage.AncestorOrSelf(1).GetPropertyValue<string>("callbackTooltip"),
            CallbackButtonText = CurrentPage.AncestorOrSelf(1).GetPropertyValue<string>("callbackButtonText")
        });
    }
    
    
    [HttpPost]
    public ActionResult RequestCallback(CallbackFormModel model)
    {
        String fieldError = String.Empty;
        var member = umbraco.cms.businesslogic.member.Member.GetCurrentMember();
        StringBuilder fieldErrorString = new StringBuilder();
    
        var recipientProp = CurrentPage.AncestorOrSelf(1).GetProperty("callbackRecipient");
        var senderProp = CurrentPage.AncestorOrSelf(1).GetProperty("callbackSender");
        var subjectProp = CurrentPage.AncestorOrSelf(1).GetProperty("callbackSubject");
        var responseProp = CurrentPage.AncestorOrSelf(1).GetProperty("callbackResponse");
        var responsePage = CurrentPage.AncestorOrSelf(1).GetProperty("callbackRedirection");
    
    
        if (recipientProp == null || recipientProp.Value == null || recipientProp.Value.ToString().Length == 0)
        {
            fieldError = "The 'Callback Recipient Email Address' property has not been completed";
            fieldErrorString.AppendLine(fieldError);
            if (member != null) throw new MissingFieldException(fieldError);
        }
    
        if (senderProp == null || senderProp.Value == null || senderProp.Value.ToString().Length == 0)
        {
           fieldError = "The 'Callback Sender Email Address' property has not been completed";
           fieldErrorString.AppendLine(fieldError);
           if (member != null) throw new MissingFieldException(fieldError);
        }
        if (subjectProp == null || subjectProp.Value == null || subjectProp.Value.ToString().Length == 0)
        {
            fieldError = "The 'Callback Subject Line' property has not been completed";
            fieldErrorString.AppendLine(fieldError);
            if (member != null) throw new MissingFieldException(fieldError);
        }
    
        if (responseProp == null || responseProp.Value == null || responseProp.Value.ToString().Length == 0)
        {
            fieldError = "The 'Callback Thank You Message' property has not been completed";
            fieldErrorString.AppendLine(fieldError);
            if (member != null) throw new MissingFieldException(fieldError);
        }
    
        if (responsePage == null || responsePage.Value == null || responsePage.Value.ToString().Length == 0)
        {
            fieldError = "The 'Callback Thank You Page' property has not been completed";
            fieldErrorString.AppendLine(fieldError);
            if (member != null) throw new MissingFieldException(fieldError);
        }
    
    
    
        if (!ModelState.IsValid)
        {
            String errorMessage = "Oops! We've hit a small glitch but the site admins have been notified at " + DateTime.Now + ". Please ring us directly at your earliest convenience.";
            TempData.Add("Status", errorMessage );
            SendErrorReport("[email protected]", "website.lawcare.org.uk", "[email protected]",
                                   "Callback Form Error.", fieldErrorString.ToString(), CurrentPage.Name);
            model.ShowForm = false;
            model.ShowMessage = true;
            return CurrentUmbracoPage();
        } 
    
        //SendSmtpEmail(recipientProp.Value.ToString(), senderProp.Value.ToString(), "[email protected]", subjectProp.Value.ToString(), model);
    
        SendSmtpEmail("[email protected]", senderProp.Value.ToString(), "[email protected]", subjectProp.Value.ToString(), model);
    
        model.ShowForm = false;
        model.ShowMessage = true;
    
    
        //return RedirectToCurrentUmbracoPage();
        //return CurrentUmbracoPage();
        return RedirectToUmbracoPage(Convert.ToInt32(responsePage.Value));
    }
    
    private void SendSmtpEmail(string recipientEmail, string senderEmail, string adminEmail, string subjectLine, CallbackFormModel model)
    {
        StringBuilder body = new StringBuilder();
        body.AppendLine(subjectLine);
        body.AppendLine();
        body.AppendLine("Requesters Phone Number: " + model.CallbackPhoneNumber);
        body.AppendLine();
        body.AppendLine("Regards,");
        body.AppendLine("Lawcare Website Robot");
    
    
        MailMessage internalMessage = new MailMessage();
        internalMessage.To.Add(new MailAddress(recipientEmail));
        internalMessage.From = new MailAddress(senderEmail);
        internalMessage.Bcc.Add(new MailAddress(adminEmail));
        internalMessage.Body = body.ToString();
        internalMessage.Subject = subjectLine + ": " + CurrentPage.Name;
        internalMessage.IsBodyHtml = false;
    
        SmtpClient smtpInternal = new SmtpClient();
        smtpInternal.Send(internalMessage);
    
     }
    
    
    private void SendErrorReport(String emailTo, String emailFrom, String emailBcc, String emailSubject, String emailMessage, String errorLocation)
    {
        StringBuilder body = new StringBuilder();
        body.AppendLine(emailSubject);
        body.AppendLine();
        body.AppendLine("Error: " + emailMessage);
        body.AppendLine();
        body.AppendLine("Regards,");
        body.AppendLine("Lawcare Website Robot");
    
    
        MailMessage internalMessage = new MailMessage();
        internalMessage.To.Add(new MailAddress(emailTo));
        internalMessage.From = new MailAddress(emailFrom);
        internalMessage.Bcc.Add(new MailAddress(emailBcc));
        internalMessage.Body = body.ToString();
        internalMessage.Subject = emailSubject + ": " + errorLocation;
        internalMessage.IsBodyHtml = false;
    
        SmtpClient smtpInternal = new SmtpClient();
        smtpInternal.Send(internalMessage);
    
    }
    
    }
    
    public class CallbackFormModel
    {
        public bool ShowMessage { get; set; }
        public bool ShowForm { get; set; }
    
        public string CallbackFormIdentity { get; set; }
        public string CallbackHeadline { get; set; }
        public string CallbackPlaceholder { get; set; }
        public string CallbackTooltip { get; set; }
        public string CallbackButtonText { get; set; }
    
        public string UpdateTargetBox { get; set; }
    
        [Required(AllowEmptyStrings = false, ErrorMessage = "Please enter your phone number")]
        [Display(Name = "We can also call you", Prompt = "Your Phone Number")]
        [DataType(DataType.PhoneNumber)]
        public string CallbackPhoneNumber { get; set; }
    }
    

    Have I done something wrong in the upgrade or what?

    As always all help is greatly appreciated and I can give access to files or anything else if need be!

    Thank you for your time and patience!

    Jon @precisioncoding

  • Bezmundo 48 posts 139 karma points
    Aug 09, 2013 @ 13:10
    Bezmundo
    0

    hey Jon, did you manage to fix this issue as i'm having the same problem.

    Thanks 

  • Jon R. Humphrey 164 posts 455 karma points c-trib
    Aug 09, 2013 @ 13:15
    Jon R. Humphrey
    0

    Bezmundo,

    Sadly no, I didn't. I rolled the site back to the 6.0.5 version from backup and will be migrating content to a new instance of the 6.1.3 version when I return to my desk after next week.

    If you find anything else on this please let me, and the core, know!

    Sorry I could be more help.

    Jon

  • mark firth 30 posts 73 karma points
    Aug 09, 2013 @ 13:30
    mark firth
    0

    Had the same error from a clean install of 6.1.3. Over wrote the BIN with a 6.1.1 install BIN files and set the web config.

  • Wietze Strik 27 posts 131 karma points
    Feb 13, 2014 @ 12:21
    Wietze Strik
    0

    I also had this error while updating from 6.0.5 to 6.1.6. I had two MVC projects that I had build, one of them gave this same error.

    I created a new clean MVC4 project on .NET 4.5 (4.0 gave this error to) and imported my source code. Everithing works fine now.

    Hope this helps

  • Damiaan 439 posts 1293 karma points MVP 4x c-trib
    Aug 11, 2014 @ 21:30
    Damiaan
    104

    I had also this error when I had my controllers in the App_Code. When I embedded the classes into a namespace, everything worked again!

    namespace MyControllers { // added this line!
      // previous code
      public class MySController : SurfaceController {
        [ChildActionOnly]
        public ActionResult Index() {
          return PartialView();
        }
      }
    }
    
  • Sumesh KP 32 posts 104 karma points c-trib
    Jul 08, 2016 @ 08:49
    Sumesh KP
    0

    Perfect, Thanks @Damiaan

    It's working for me.

  • Mohammad Javed 64 posts 373 karma points
    Nov 08, 2015 @ 14:39
    Mohammad Javed
    0

    @Damiaan thanks for the solution, well fix!

    Otherwise i would have been bold by the start of tomorrow. Awesome!

    Got to love the Umbraco Community!

  • Damiaan 439 posts 1293 karma points MVP 4x c-trib
    Jul 08, 2016 @ 09:10
    Damiaan
    1

    Bold or bald? ;-)

  • Raymond Rotgans 7 posts 75 karma points
    May 23, 2017 @ 06:44
    Raymond Rotgans
    0

    @Damiaan thanks for the solution. Was struggling with this for a couple of hours.

  • Damiaan 439 posts 1293 karma points MVP 4x c-trib
    Jul 18, 2017 @ 14:43
    Damiaan
    0

    Glad it solved your issue!

Please Sign in or register to post replies

Write your reply to:

Draft