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 Community Exchange, where community members ask and answer questions about DNN. To get started, just start typing your question below and either select one of the suggested questions or ask a new question of your own.

Services Framework WebAPI operational

Return to previous page

  • 2/13/2013
  • 2902 Views
  • 2 Answers
  • Last Activity: long time ago, damon1

Question:

damon1 long time ago

I am new to DNN.  Not new to development.  I hope this is an appropriate place to post a question about development to the community.

I am trying to setup a WebAPI using services framework.  I have followed this blog and this blog.  I have a visual studio class project setup to output a dll in my local development iis server bin directory (C:\inetpub\wwwroot\bin).  The module compiles and puts the dll in the location I would expect.  I am not getting a route to register and try as I may cannot determine why.  Can anyone offer any insight?  

RouteMapper.cs contains:

using System;
using DotNetNuke.Web.Api;
 
namespace MyServices
{
    class RouteMapper : IServiceRouteMapper
    {
        public void RegisterRoutes(IMapRoute mapRouteManager)
        {
            mapRouteManager.MapHttpRoute("MyServices", "default", "{controller}/{action}", new[] { "MyServices" });
        }
    }
}

WelcomeController.cs contains

using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using DotNetNuke.Web.Api;
 
namespace MyServices
{
    public class WelcomeController : DnnApiController
    {
        [AllowAnonymous]
        [HttpGet]
        public HttpResponseMessage HelloWorld()
        {
            return Request.CreateResponse(HttpStatusCode.OK, "Hello World!");
        }
 
    }
}

My log does not show the route gettting mapped

<br>2013-02-13 15:19:23,457 [D5TSBXQ1][Thread:7][TRACE] DotNetNuke.Common.Initialize - Request /Host/HostSettings/tabid/16/portalid/0/Default.aspx
<br>2013-02-13 15:19:23,463 [D5TSBXQ1][Thread:7][INFO] DotNetNuke.Common.Initialize - Application Initializing
<br>2013-02-13 15:19:23,926 [D5TSBXQ1][Thread:7][TRACE] DotNetNuke.Web.Api.Internal.ServicesRoutingManager - Mapping route: CoreMessaging-default-0 @ DesktopModules/CoreMessaging/API/{controller}/{action}
<br>2013-02-13 15:19:23,932 [D5TSBXQ1][Thread:7][TRACE] DotNetNuke.Web.Api.Internal.ServicesRoutingManager - Mapping route: SocialGroups-default-0 @ DesktopModules/SocialGroups/API/{controller}/{action}
<br>2013-02-13 15:19:23,938 [D5TSBXQ1][Thread:7][TRACE] DotNetNuke.Web.Api.Internal.ServicesRoutingManager - Mapping route: Journal-default-0 @ DesktopModules/Journal/API/{controller}/{action}
<br>2013-02-13 15:19:23,945 [D5TSBXQ1][Thread:7][TRACE] DotNetNuke.Web.Api.Internal.ServicesRoutingManager - Mapping route: MemberDirectory-default-0 @ DesktopModules/MemberDirectory/API/{controller}/{action}
<br>2013-02-13 15:19:24,002 [D5TSBXQ1][Thread:7][TRACE] DotNetNuke.Web.Api.Internal.ServicesRoutingManager - Mapping route: InternalServices-default-0 @ DesktopModules/InternalServices/API/{controller}/{action}
<br>2013-02-13 15:19:24,283 [D5TSBXQ1][Thread:7][TRACE] DotNetNuke.Web.Api.Internal.ServicesRoutingManager - Registered a total of 5 routes

DNN Info:

DotNetNuke Community Edition
07.00.03 (64)
SqlDataProvider
4.0
IIS APPPOOL\DefaultAppPool
D5TSBXQ1
fe80::d065:e086:83ff:2056%11
ReflectionPermission, WebPermission, AspNetHostingPermission
/
C:\inetpub\wwwroot

Services Framework WebAPI operational

damon1
damon1 long time ago
Add an Answer

Answers

Sign In to Participate
Or register to become a member