简体   繁体   English

WebAPI 帮助页面 - 错误 404

[英]WebAPI Help Page - Error 404

I followed the tutorial on ASP.Net website to add Help Pages on a WebAPI empty project.我按照 ASP.Net 网站上的教程在 WebAPI 空项目上添加帮助页面。 ( http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages ) ( http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages )

The thing is that I indeed access the help page index but when I click on a end point link to get details and samples it gives me a 404 error.问题是我确实访问了帮助页面索引,但是当我单击端点链接以获取详细信息和示例时,它给了我 404 错误。

Here is the screen shot:这是屏幕截图: 404错误

I don't know why it doesn't work, I have currently a Model, and a controller with Entity Framework.我不知道为什么它不起作用,我目前有一个模型和一个带有实体框架的控制器。

Does anyone know what is wrong?有谁知道出了什么问题?

You can use Swaggger instead for help pages.您可以将 Swaggger 用于帮助页面。 It's better than the WebAPI Help.它比 WebAPI 帮助更好。 Just download this package through NuGet:只需通过 NuGet 下载这个包:

<package id="Swashbuckle" version="5.2.2" targetFramework="net452" />

In the Global.asax file, add the following code to the Application_Start method, if it is not there already:在 Global.asax 文件中,将以下代码添加到 Application_Start 方法中(如果尚未存在):

protected void Application_Start()
{
    // Add this code, if not present.
    AreaRegistration.RegisterAllAreas();

    // ...
}

to register areas.注册区域。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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