MVC4 WebApi中的REST帮助页和REST测试客户端
我使用早期版本的webapi(0.6.0)开发了几个REST服务,对于我的服务,我在RegisterRoutes中启用了帮助页面和测试客户端,如下所示(从应用程序开始调用:MVC4 WebApi中的REST帮助页和REST测试客户端,rest,asp.net-web-api,Rest,Asp.net Web Api,我使用早期版本的webapi(0.6.0)开发了几个REST服务,对于我的服务,我在RegisterRoutes中启用了帮助页面和测试客户端,如下所示(从应用程序开始调用: routes.Add(new ServiceRoute("auth", new HttpServiceHostFactory() { Configuration = new HttpConfiguration()
routes.Add(new ServiceRoute("auth",
new HttpServiceHostFactory()
{
Configuration = new HttpConfiguration()
{
EnableTestClient = true,
EnableHelpPage = true
}
},
typeof(Auth_Api)));
所以我可以在
http://<myserver>/auth
我是否可以将System.ServiceModel.Activation和Microsoft.ApplicationServer.Http.Activation程序集添加到MVC4 webapi应用程序,并像以前一样设置路由
如果我这样做有什么缺点(以防奏效)
感谢查看API Explorer以获得生成帮助页面的功能。我相信测试客户端暂时已被删除。我认为有计划将其恢复。我记不清了。谢谢,我已经找到了它,还找到了一篇有趣的文章,介绍了ApiExplorer与PostMan的结合使用,这是一个允许构建的chrome扩展g一个REST客户机。
http://<myserver>/auth/help
http://<myserver>/auth/test
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);