简体   繁体   中英

IIS 7.5 only shows homecontroller

I have my IIS set up like this:

布局

The default website works like it should. But the API only loads the default page

all the other routes give me 错误

Any clue on how to fix this? this is the WebApiConfig.cs from the api

 public static void Register(HttpConfiguration config)
        {
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
            config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
            config.Filters.Add(new AuthorizeAttribute());
        }

Found the sollution:

The problem was that the /api worked as root, so /api/api/videos would call the video controller.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM