Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
After upgrading a recent site from 7.5.4 - 8.15.1 it went through staging then live.
Once it hit live the following error intermittently appears:
Unable to resolve type: MySurfaceController, service name:
Code is in the App_Code folder. I haven't seen this issue before, can anyone help please?
MySurfaceController looks like this:
public partial class MySurfaceController: Umbraco.Web.Mvc.SurfaceController
public ActionResult Index(ContentModel model)
[InvalidOperationException: Unable to resolve type: MySurfaceController, service name: ]
LightInject.ServiceContainer.CreateDelegate(Type serviceType, String serviceName, Boolean throwError) in C:\projects\lightinject\src\LightInject\LightInject.cs:4754
LightInject.ServiceContainer.CreateDefaultDelegate(Type serviceType, Boolean throwError) in C:\projects\lightinject\src\LightInject\LightInject.cs:4705
LightInject.ServiceContainer.GetInstance(Type serviceType) in C:\projects\lightinject\src\LightInject\LightInject.cs:3437
Umbraco.Web.Mvc.ContainerControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) in D:\a\1\s\src\Umbraco.Web\Mvc\ContainerControllerFactory.cs:21
[Exception: Failed to create an instance of controller type TWB.Controllers.Surface.StoreFinderController (see inner exception).]
Umbraco.Web.Mvc.ContainerControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) in D:\a\1\s\src\Umbraco.Web\Mvc\ContainerControllerFactory.cs:25
Umbraco.Web.Mvc.UmbracoControllerFactory.CreateController(RequestContext requestContext, String controllerName) in D:\a\1\s\src\Umbraco.Web\Mvc\UmbracoControllerFactory.cs:38
Umbraco.Web.Mvc.RenderControllerFactory.CreateController(RequestContext requestContext, String controllerName) in D:\a\1\s\src\Umbraco.Web\Mvc\RenderControllerFactory.cs:36
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +262
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +77
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +131
A couple of things, when you say upgrade what do you mean, if you've upgraded using nuget or something? You cannot upgrade from 7 to 8, at least not easily, nor recommended. You would need to start a new project and migrate content etc.
It's been a while since I've used App_Code so I would recommend moving controllers into their own /controllers/ folder.
It would help to know what you're doing with this Surface controller, especially as you're expecting, 'ContentModel' being passed in.
Finally your error mentions MySurfaceController but your class is called StoreFinderController
I don't think the upgrade/migration part is the problem as I following all the Umbraco guidelines.
I don't normally use App_Code either but it's an inherited project.
Ignore the MySurfaceController thing (I was trying to simplify the example).
The issue seems related to dependency injection, as the stack trace bombs on LightInject with an "unable to resolve type" error. This would suggest that the SurfaceController isn't registered in the DI pipeline at the point it tries to access it (I'm assuming App Start).
Thanks for taking the time to respond. Any help is appreciated.
Hello Brendan Rice,
I'm facing the exact issue with my Umbraco 8 Solution. Did You manage to solve this mycardstatement - if so, would You care to share...?
No luck yet Larry. The issue has stabilised but if I frig with the Web.Config it'll blow up again.
It seems like something to do with the way Umbraco is handling the Dependency Injection around surface controllers.
You could try to register the controller via a Composer to see if this fixes your issue.
You can do something like this:
public class CmsSetupComposer : IUserComposer
public void Compose(Composition composition)
I found this in a issue op umbraco github: https://github.com/umbraco/Umbraco-CMS/issues/7704
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted