0
votes

I'm writing a asp.net web service which contains a web controller. today I add a new webapi controller to my project, when I send a request to oldest controller everything is ok and I get correct response. but when I send a request to new one, my browser(MS Edge) returns this error:

HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR): POST - http://localhost:3982/api/ViewTemplates

It returns error while both of controllers are in a same namespace and place together in a folder.

I try defining my new request path

http://localhost:3982/api/ViewTemplates

manually in WebApiConfig.cs but it doesn't work so I change this class to it's default configuration.

can you help me?

thanks

2
Please add more information such as how routing is defined? Maybe snippets of the code around the old and the new controller methods. - Abhay Saraf

2 Answers

0
votes

Did you try Delete bin directory, clean solution and rebuild.

0
votes

HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR): POST - http://localhost:3982/api/ViewTemplates

This Error means the url you are requesting on this link http://localhost:3982/api/ViewTemplates not exists. Check folder path or project path directory.

Second thing is most of filenames in asp project has .aspx at the end like this http://localhost:3982/api/ViewTemplates.aspx