1項目搜索NuGet包 swashbuckle
2訪問連接:http://域名:端口/swagger
3 添加方法的註釋,在SwaggerSconfig.cs 的Register()方法裏,找到GetXmlCommentsPath 去掉這行代碼的註釋
並添加
protected static string GetXmlCommentsPath()
{
return System.String.Format(@"{0}\bin\文件名.XML", System.AppDomain.CurrentDomain.BaseDirectory);
}
4項目右鍵屬性 > 生成 > xml文檔文件 >填寫路徑與GetXmlCommentsPath方法裏面的路徑保持一致 如:bin\文件名.XML