Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 19, 2012 02:50 PM by calvindale
Nov 16, 2012 09:18 PM|LINK
I have deployed a web api project to a on-prem server. The server returns razor pages properly; but web api calls return 404. I've verified that web api controller code isn't being hit.
So the routing mechanism doesn't seem to be wired up correctly.
I have installed .NET 4.5 and ASP.NET MVC 4 on the server. I also tried setting Copy Local for all DLLs.
Nov 16, 2012 11:34 PM|LINK
what is the message in the response body?
Nov 16, 2012 11:41 PM|LINK
404 - File or directory not found.
Nov 17, 2012 12:02 AM|LINK
So I discovered that I am able to fetch the web-api data via the browser or Fiddler (by specifying a full path). But my app doesn't work on the server.
Apparently the URLs in the json calls are acceptable on the dev machine and incorrect for the server.
The call in question looks like:
$.getJSON("/api/imagemetrics/" + partNumber, ....
I haven't figured yet out how to make it work on both machines. (I'm a bit of a newbie to JS/HTML5/XHR).
Nov 17, 2012 05:58 AM|LINK
Are your ajax calls coming from a different domain than where your API is hosted? It doesn't sound like its in issue with your URI's it may be a problem with CORS.
Nov 19, 2012 02:50 PM|LINK
Removing the preceeding forward slash from the URI did the trick.