This has to be something really dumb but I can't think what else to do.
Using Visual Studio 2013 - Update 1, I created an empty web api 2 project in an existing solution, added the cross origin support (cors) package and created a basic web api controller.
The WebApiConfig class seems to be fine:
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
var cors = new EnableCorsAttribute("*","*","*");
config.EnableCors(cors);
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
And also the Global.asax
protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
}
I then run the application, IIS express starts normally and the browser starts with the application's url but nothing seems to work.
If the URL is "localhost:port number" I get HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.
If I try "localhost:port number/api" I get HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I have looked at several blogs, tutorials, examples and I haven't seen anywhere that anything special needs to be done. Could someone please shed some light in what I might be missing?