locked
web api method is not showing RRS feed

  • Question

  • User81789783 posted

    i have below code

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    namespace MvcApplication1.Controllers
    {
        public class ContactController : Controller
        {
            //
            // GET: /Contact/
    
            public ActionResult Index()
            {
                return View();
            }
            public string[] Get()
            {
                return new string[]
        {
            "Hello",
            "World"
        };
            }
    
        }
    }
    

    but when i run http://localhost:5426/api/contact ,it gives below

    <Error>
    <Message>No HTTP resource was found that matches the request URI 'http://localhost:5426/api/contact'.</Message>
    <MessageDetail>No type was found that matches the controller named 'contact'.</MessageDetail>
    </Error>

    Saturday, December 12, 2020 11:32 AM

Answers

  • User475983607 posted

    The code shown is an MVC action not Web API.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 12, 2020 1:18 PM

All replies

  • User475983607 posted

    The code shown is an MVC action not Web API.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 12, 2020 1:18 PM
  • User81789783 posted

    yes u are right ,i already corrected issue

    Saturday, December 12, 2020 2:47 PM