Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9051491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:55:05+00:00 2026-06-16T12:55:05+00:00

I am using Web API in my Web Forms project. I have the following

  • 0

I am using Web API in my Web Forms project. I have the following code in my project’s Application_Start method in Global.asax:

GlobalConfiguration.Configuration.Routes.MapHttpRoute("ApiDefault", "api/{controller}/{id}", New With {.id = RouteParameter.Optional})

This is basically copied and pasted from a Microsoft tutorial on the subject.

I also have a test controller named ValuesController. This class is just the default Web API controller one gets when creating a controller from the Add New Item wizard and is in a folder in my Web Forms site named Controllers:

Imports System.Net
Imports System.Web.Http

Public Class ValuesController
    Inherits ApiController

    ' GET api/<controller>
    Public Function GetValues() As IEnumerable(Of String)
        Return New String() {"value1", "value2"}
    End Function

    ' GET api/<controller>/5
    Public Function GetValue(ByVal id As Integer) As String
        Return "value"
    End Function

    ' POST api/<controller>
    Public Sub PostValue(<FromBody()> ByVal value As String)

    End Sub

    ' PUT api/<controller>/5
    Public Sub PutValue(ByVal id As Integer, <FromBody()> ByVal value As String)

    End Sub

    ' DELETE api/<controller>/5
    Public Sub DeleteValue(ByVal id As Integer)

    End Sub

End Class

HOWEVER – when I go to http://localhost/api/Values – instead of seeing some XML serializing the strings value1 and value2, I see an error message like so:

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

So – clearly, routing is working, since instead of getting a 404 I get a message saying that the route itself doesn’t resolve to anything. But the route should resolve to something – specifically, my ValuesController class which is even in a folder named Controllers.

Anyone know what I’m doing wrong?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T12:55:06+00:00Added an answer on June 16, 2026 at 12:55 pm

    I figured it out. It’s because apparently MVC requires that the Controllers folder be at the same level as the file declaring the routes – not (as I previously thought) simply at the root level.

    Ugh.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the ASP.NET Web-Api, I have the following POST setup in my controller. When
I am learning and using Web API and need to implement following Authentication mechanism
I'm using asp.net web forms with Web Api. I can make the call over
The following is my code for using Google Translate. I have one dll I
I have a Web API project as part of my solution (also containing an
I am using ASP.NET Web API . I want to download a PDF with
I am using MVC4's WEB API to expose a controller. Initially I created created
I am creating a web api using asp.net mvc4 and the response output is
I am building a Web API using MVC4 and some request return blocks of
I've been using Google Web Search API but the searched keyword is coming highlighted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.