在Web API中使用Swagger来提供元数据

时间:2016-11-17 20:46:35

标签: c# asp.net asp.net-web-api swagger swagger-ui

我创建了Web API,它接受输入参数并返回JSON结果。由于我们无法在添加Web引用时使用Web API enter image description here 我尝试从Nugget Package为WebAPI安装Swagger UL for .Net和Swashbuckle-Swagger。现在尝试调试应用程序时http://localhost:24417/它会抛出错误说

Method 'GetDocumentation' in type 'Swagger.Net.XmlCommentDocumentationProvider' from assembly 'Swagger.Net, Version=0.5.1.0, Culture=neutral, PublicKeyToken=null' does not have an implementation. Line 38: throw new Exception("Please enable \"XML documentation file\" in project properties with default (bin\\TGSSampleData.XML) value or edit value in App_Start\\SwaggerNet.cs");

我试图启用 enter image description here 但仍然会抛出同样的错误。也有人可以告诉我们如何从浏览器调用端点。在招摇之前,我使用http://localhost:46151/api/TGSData?ROOM=KOMP2&DOB_GT=01-05&DOB_LT=30-DEC-06&STATUS_TYPE=CMPLT进行调用,它将返回JSON结果。请帮帮我这个

1 个答案:

答案 0 :(得分:0)

我认为这可以从throw消息WebElement test1 =driver.findElement(By.xpath("//table[@class='table table-striped-admin']//tr[contains(td[1],'Tag Name 1')]/td/code")); test1.getText();

中自我解释

您可以在XML文件中进行更改,或者调用Please enable \"XML documentation file\" in project properties with default (bin\TGSanokeData.XNK) value or edit value in App_Start\Swaggernet.cs");GlobalConfiguration.Configuration.EnableSwagger来设置正确的值。这些与招摇无关。这些是与配置设置相关的问题。

相关问题