API Get Resuqest: No HTTP resource was found that matches the request URI

Micah Holmes 126 Reputation points
2021-11-10T16:49:52.227+00:00

Trying to reach:
http://localhost:3647/api/DocUSign/Get_GetSupplyOrderFormConnection

Getting error:
<Error>
<Message>No HTTP resource was found that matches the request URI 'http://localhost:3647/api/DocUSign/Get_GetSupplyOrderFormConnection'.</Message>
<MessageDetail>No type was found that matches the controller named 'DocUSign'.</MessageDetail>
</Error>

Here is my code snippet:

using GSU_DocUSign_API.Models.DocUSign;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using HttpGetAttribute = System.Web.Http.HttpGetAttribute;
using HttpPostAttribute = System.Web.Http.HttpPostAttribute;
using RouteAttribute = System.Web.Http.RouteAttribute;

namespace GSU_DocUSign_API.Controllers
{
    public class DocUSignController : Controller
    {
        API_Functions _API_Functions = new API_Functions();
        DocUSign_DataHelper _DataHelper = new DocUSign_DataHelper();

        [Route("api/DocUSign/Get_GetSupplyOrderFormConnection")]
        [HttpGet]
        public string RequestAllSupplyOrderFormData()
        {
            return "Connected";
        }

Route config class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace GSU_DocUSign_API
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}
Developer technologies | ASP.NET | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Lan Huang-MSFT 30,191 Reputation points Microsoft External Staff
    2021-11-11T06:02:18.877+00:00

    Hi @Micah Holmes ,

    No type was found that matches the controller named 'DocUSign'.

    Your error shows that the controller name cannot be found.
    You need to make it clear whether you are using mvc routing or WebAPI routing.
    MVC routing configuration file RouteConfig,
    url: "{controller}/{action}/{id}"
    WebAPI routing configuration file WebApiConfig.
    routeTemplate: "api/{controller}/{id}"
    WebAPI
    public class DocUSignController : ApiController
    {
    [Route("api/DocUSign/")]
    [HttpGet]
    public string RequestAllSupplyOrderFormData()
    {
    return "Connected";
    }
    }

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.