This project is read-only.

Issues ive run in to upgrading to MVC4 with WebApi 4 (so far)

Topics: Core, General
Mar 6, 2012 at 1:59 PM

Hi Chaps,

I have attempted to update a subset of Orchard CMS to use MVC4 and the latest Web Api.

What I am working with...

Orchard.Framework (majority of)
Individual modules

Everything is upgraded using nuget packages for the time being and everything builds (so I guess that's a good start!) - Before I upgraded to MVC4 etc, I did have WebApi Preview 6 running within it and everything worked... Its only broken since upgraded to 4.

So.. The error I seem to be getting is...

<string>No type was found that matches the controller named 'videoentries'.</string>

I have a Controller within my module that inherits from ApiController and have also setup my ChellContainerContext like so...

foreach (var item in blueprint.ServiceControllers) {
    var serviceKeyName = (item.AreaName + "/" + item.ControllerName).ToLowerInvariant();
    var serviceKeyType = item.Type;
    RegisterType(builder, item)
        .WithMetadata("ControllerType", item.Type)
        .OnActivating(e => {
            var controller = e.Instance as ApiController;

I am also registering my Routes in my module like so...

    public class Routes : IRouteProvider {
        public IEnumerable<RouteDescriptor> GetRoutes()
            return new[]
                           new RouteDescriptor
                                   Priority = 1,
                                   Route = MapHttpRoute(
                                        new RouteValueDictionary {
                                                                    {"area", "Itv.News"},
                                        new RouteValueDictionary (),
                                        new RouteValueDictionary {
                                                                    {"area", "Itv.News"},

        public static Route MapHttpRoute(string name, string routeTemplate, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens) {
            return new HttpWebRoute(routeTemplate, HttpControllerRouteHandler.Instance) {
                Defaults = (defaults),
                Constraints = (constraints),
                DataTokens = (dataTokens)

There has got to be something I am missing... any Ideas would be of help... because I have run out of them!


Mar 6, 2012 at 5:41 PM

Dont worry chaps!!! All solved!!.. and ITS ALIVE!!

Mar 6, 2012 at 5:41 PM

BTW will post details tomorrow.

Mar 6, 2012 at 9:37 PM

Totally Awesome dude! Can't wait to unleash some kick ass web apis via Orchard. Keep us posted!

Mar 17, 2012 at 11:59 AM

And the fix was...?