Copied to clipboard

Flag this post as spam?

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


  • Nathan Doak 5 posts 87 karma points
    May 19, 2015 @ 20:13
    Nathan Doak
    0

    404 error when trying to access api controller

    Here is my setup, I've got a studio project which generates an assembly with only the following class:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Web.Http;
    using Umbraco.Web.WebApi;
    
    namespace engsoft_cms
    {
        public class ProfilesV1ApiController : UmbracoApiController
        {
            [HttpGet]
            public string Get()
            {
                return "HI!!! HAPPY DAYS!!";
            }
        }
    }

    I copy this to my server's bin directory, recycle the worker process, then when I try to access http://mysite/umbraco/api/profilesv1api/ ; I get a 404. I've also tried /umbraco/api/profilesv1 /api/profilesv1api/ etc. I feel like I am missing something obvious.

    The server is running on Server 2012 Umbraco 7.2.5

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 20, 2015 @ 07:06
    Jan Skovgaard
    0

    Hi Nathan

    You should be able to go to /umbraco/api/profilesv1/Get and then see the "HI!!! HAPPY DAYS!!" text.

    Don't know if you have seen the documentation about this here? https://our.umbraco.org/documentation/Reference/WebApi/

    /Jan

  • Nathan Doak 5 posts 87 karma points
    May 20, 2015 @ 18:26
    Nathan Doak
    1

    Hello Jan,

    Thanks for the link to the docs, I should just bookmark this for when I invariabily forget.

    Thankfully, late in the day, I figured out what the problem was. I accidentally updated the microsoft libraries from nuget. Because of assembly version mismatches my assembly wasn't loading and the calls were throwing errors.

    A new avenue I need to now explore is why I was not seeing any error output in the trace log and event vewer.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 20, 2015 @ 18:30
    Jan Skovgaard
    0

    Hi Nathan

    You're welcome and thanks for sharing what you learned - Others might benefit from this :)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft