Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedWebAPI - Unable to locate a controller WebAPI - Unable to locate a controller
Previous
 
Next
New Post
3/25/2013 3:20 AM
 

Just forgot to mention the followiing details:

I am using the latest dnn 7.0.4 Version - a fresh installation from yesterday on my windows8 dev-machine with SQL 2008 and Visual Studio 2012 Pro - NET4 and Integrated App Pool assigned to the Application on the Win8 IIS8

Thanks

 
New Post
4/17/2013 5:44 AM
 
Hi Gerald,

Better you can create another class RouteMapper class having name mmmModule1RouteMapper.cs and put the follwing code in this class.

Public Sub RegisterRoutes(mapRouteManager As IMapRoute) Implements IServiceRouteMapper.RegisterRoutes
        mapRouteManager.MapHttpRoute("mmmModule1", "default", "{controller}/{action}", New[] {"mmmModule1"})

Thanks,
Avinash Kumar [ DNN Developer, Mindfire Solutions,India ]

 
New Post
4/22/2013 7:12 PM
 

I'm having the same error message as the original poster had ("Unable to locate a controller for..."), but I can't figure out what to do exactly.  Here are my 2 classes.  Anyone see my issues?  I'm trying to add this to an existing c# 4.0 project. I feel like I'm really close.

//////////////////////////// WelcomeController.cs

using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using DotNetNuke.Web.Api;

namespace RainstormTech.Modules.Storm
{

    public class WelcomeController : DnnApiController
    {
        [AllowAnonymous]
        [HttpGet]
        public HttpResponseMessage HelloWorld()
        {
            return Request.CreateResponse(HttpStatusCode.OK, "The time is: " + DateTime.Now.ToLongTimeString());
        }
    }
}

////////////////////////////////////////////// StormRouteMapper.cs

using DotNetNuke.Web.Api;

namespace RainstormTech.Modules.Storm
{
    public class StormRouteMapper : IServiceRouteMapper
    {
        public void RegisterRoutes(IMapRoute mapRouteManager)
        {
            mapRouteManager.MapHttpRoute("Storm", "default", "{controller}/{action}", new[] { "RainstormTech.Modules.Storm" });
        }
    }
}

//////////////// More info

I even debugged it locally and while stepping through it,  I found that my controller didn't exist if the dictionary of DescriptorCache as in the following Core code:

var matches = new List();
foreach (string ns in namespaces)
{
    string fullName = GetFullName(controllerName, ns);

    HttpControllerDescriptor descriptor;
    if (DescriptorCache.TryGetValue(fullName, out descriptor)) // never matches here
    {
        matches.Add(descriptor);
    }
}

Hopefully someone knows what I need to do.  Thanks.

 
New Post
4/23/2013 1:12 PM
 
looks like the namespace is probably wrong (does factor in the Welcome part) - the easiest way to check this is to enable services framework tracing (http://www.dotnetnuke.com/Resources/W...), and then check the log4net files as they will show lines registering the controller types found - you'll often notice your naming issue at this point.

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
4/24/2013 12:01 AM
 

Cathal,  I enabled that appsetting, but this is all I get:

 2013-04-23 21:54:49,976 [Typhoon][Thread:25][ERROR] DotNetNuke.Web.Api.TraceWriter -  GET http://dev.novelcrossing.com/desktopmodules/Storm/API/Welcome/HelloWorld System.Web.Http.Controllers 

It doesn't really point me in any certain direction.  Also, I don't know how my namespace could be wrong as I use the same namespace for all of my controller classes in the system.  Any other ideas?

 thanks,

kristian

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedWebAPI - Unable to locate a controller WebAPI - Unable to locate a controller


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out