I have an ASP.NET Web API which works fine when running on “IIS Express” with localhost:1783
But when I uncross the “Use IIS Express” and then press “Create Virtual Directory”…
…I just get 404 errors:
Any ideas whats wrong? Thanks!
While the marked answer gets it working, all you really need to add to the webconfig is:
<handlers> <!-- Your other remove tags--> <remove name="UrlRoutingModule-4.0"/> <!-- Your other add tags--> <add name="UrlRoutingModule-4.0" path="*" verb="*" type="System.Web.Routing.UrlRoutingModule" preCondition=""/> </handlers>
Note that none of those have a particular order, though you want your removes before your adds.
The reason that we end up getting a 404 is because the Url Routing Module only kicks in for the root of the website in IIS. By adding the module to this application’s config, we’re having the module to run under this application’s path (your subdirectory path), and the routing module kicks in.
Answered By – DavidAndroidDev
Answer Checked By – Dawn Plyler (BugsFixing Volunteer)