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

Micah Holmes 121 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 }
            );
        }
    }
}
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,252 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Lan Huang-MSFT 25,471 Reputation points Microsoft Vendor
    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