I always place the api controllers in a directory by themselves. The reason is that if you have a page called the same name as the apicontroller it will get confused. Something like this.
Global asax.
routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}", New With {.id = System.Web.Http.RouteParameter.Optional})
Create a folder called api and in that folder at your
Public Class PositionsController
Inherits ApiController
' GET api/<controller>
Public Function GetValues() As PositionListReturn
This is what I see when I browse to the root, which I believe is an issue. When this page displays an error (restriction error) I believe everything will fall in place.
Ive been following a video series on pluralsight and Ive watched it over many times. Its a frustrating issue that doesnt seem to have a logical explanation.
4.0, I've tried altering the web config and no luck. So what I just tried was creating a NEW Blank MVC4 Web API application, and that DOES seem to return values. Im running on XP 64-bit. I plan on trying this at a later point on my personal win7 pc. B
If you use without to do anything special by only creating an asp.net mvc project, it should work by default, you shouldn't have to change anything. Maybe at first, you need to validate by default by create a new asp.net mvc project 4 intranet or extranet
and try to access it, if it doesn't work, you have an issue related to your computer/setup/binaries.
In that case, try to uninstall and reinstall asp.net mvc4. I notice if you install mvc4 and mvc3 on the same machine you need to register one more time the right version of .Net in IIS.
If you issue is link to the webserver, you can change it and choose IIS or IISExpress or VisualStudio internal webserver.
dego89
None
0 Points
8 Posts
No HTTP resource was found - Web API
Jan 30, 2013 03:52 PM|LINK
I get this error when accessing my controller through a newly setup web api project.
1. My Route statement
GlobalConfiguration.Configuration.Routes.Add("default", new HttpRoute("{controller}"));2. My Controller
public class HelloController : ApiController { [HttpGet] public string Get() { return "Hello Controller"; } }the response....
No HTTP resource was found that matches the request URI 'http://localhost:4215/HomeController'
Am i doing something wrong?
panesofglass
Member
730 Points
237 Posts
Re: No HTTP resource was found - Web API
Jan 30, 2013 04:25 PM|LINK
dego89
None
0 Points
8 Posts
Re: No HTTP resource was found - Web API
Jan 30, 2013 06:00 PM|LINK
No Luck. I did notice another strange issue. When I browse to the root, the directory listing appears in the browser, which shouldnt happen.
stockcer
Member
498 Points
128 Posts
Re: No HTTP resource was found - Web API
Jan 30, 2013 07:06 PM|LINK
I always place the api controllers in a directory by themselves. The reason is that if you have a page called the same name as the apicontroller it will get confused. Something like this.
Global asax.
routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}", New With {.id = System.Web.Http.RouteParameter.Optional})Create a folder called api and in that folder at your
You would call it something like this (jquery)
$.ajax({ type: "GET", url: "/api/Positions", data: "rows=" + self.rowsPerPage() + "&page=" + self.page() + "&sidx=" + self.colName + "&sord=" + self.sortOrder + "&srch=" + self.searchString(), contentType: "application/json; charset=utf-8", dataType: "json",ASP.NET Arvixe Liaison
James River Webs, Inc.
Darrel Mille...
Member
162 Points
54 Posts
Re: No HTTP resource was found - Web API
Jan 30, 2013 07:58 PM|LINK
How about 'http://localhost:4215/Hello' considering your controller is called HelloController, not HomeController ?
dego89
None
0 Points
8 Posts
Re: No HTTP resource was found - Web API
Jan 30, 2013 08:07 PM|LINK
good catch but that was my typo in the post.
This is what I see when I browse to the root, which I believe is an issue. When this page displays an error (restriction error) I believe everything will fall in place.
http://postimage.org/image/uev90lo57/
Ive been following a video series on pluralsight and Ive watched it over many times. Its a frustrating issue that doesnt seem to have a logical explanation.
stockcer
Member
498 Points
128 Posts
Re: No HTTP resource was found - Web API
Jan 30, 2013 08:21 PM|LINK
What version of .net are you running....
try adding this to your web.config
<system.webServer> <directoryBrowse enabled="false" /> <modules runAllManagedModulesForAllRequests="true"> <remove name="UrlRoutingModule"/> <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <remove name="WebDAVModule" /> </modules> <handlers> <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web,Version=2.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/> <remove name="WebDAV" /> <remove name="ExtensionlessUrl-Integrated-4.0" /> <add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,DELETE,PUT" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers>ASP.NET Arvixe Liaison
James River Webs, Inc.
dego89
None
0 Points
8 Posts
Re: No HTTP resource was found - Web API
Jan 30, 2013 08:34 PM|LINK
4.0, I've tried altering the web config and no luck. So what I just tried was creating a NEW Blank MVC4 Web API application, and that DOES seem to return values. Im running on XP 64-bit. I plan on trying this at a later point on my personal win7 pc. B
myddoc
Member
49 Points
42 Posts
Re: No HTTP resource was found - Web API
Feb 03, 2013 03:23 PM|LINK
Hi,
Several things :
If you use without to do anything special by only creating an asp.net mvc project, it should work by default, you shouldn't have to change anything. Maybe at first, you need to validate by default by create a new asp.net mvc project 4 intranet or extranet and try to access it, if it doesn't work, you have an issue related to your computer/setup/binaries.
In that case, try to uninstall and reinstall asp.net mvc4. I notice if you install mvc4 and mvc3 on the same machine you need to register one more time the right version of .Net in IIS.
If you issue is link to the webserver, you can change it and choose IIS or IISExpress or VisualStudio internal webserver.
Best regards,
Alexandre