asp.net > swagger
환경
VS: VisualStudio2017
프레임워크: .Net Framework 4.6
Swagger 설치
도구 → NuGet 패키지 관리자 → NuGet 패키지 관리
검색에 Swashbuckle

실행
F5에서 실행한다.
URL 뒤에 "/swagger"를 붙여 액세스한다.
예)
http://localhost:60437/swagger/ui/index#/Values
아래와 같은 화면이 표시되면 성공

XML 주석 표시
다음 파일 편집
App_Start > SwaggerConfig.cs
다음 문장의 코멘트를 제거합니다.
c.IncludeXmlComments(GetXmlCommentsPath());
SwaggerConfig.cs의 마지막 꼬리 정도에 다음 메소드 추가
private static string GetXmlCommentsPath()
{
return string.Format(@"{0}\bin\SwaggerDemo.XML", System.AppDomain.CurrentDomain.BaseDirectory);
}
XML의 이름은 어셈블리 이름과 일치합니다.

이 예에서는 다음과 같습니다.
return string.Format(@"{0}\bin\SwaggerDemo.XML", System.AppDomain.CurrentDomain.BaseDirectory);
XML 주석
다음과 같은 용량으로 XML 코멘트를 붙인다
/// <summary>
/// valuesをゲット
/// </summary>
/// <returns></returns>
// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
실행
XML 주석이 표시됩니다.

Swagger의 외형 변경
다음 파일 편집
App_Start > SwaggerConfig.cs
다음 행을 제거하고 containingAssembly를 thisAssembly로 변경합니다.
(thisAssembly는 SwaggerConfig.cs의 시작 부분에 정의되어 있습니다)
c.CustomAsset("index", thisAssembly, "NameSpace.SwaggerExtensions.index.html");
NameSpace에는 다음 프로젝트 속성에 표시되는 규정된 네임스페이스에 표시되는 이름을 설정한다.

이 예에서는 다음과 같습니다.
c.CustomAsset("index", thisAssembly, "ECommerceName.SwaggerExtensions.index.html");
Index.html 배치
SwaggerExtensions 폴더를 만들고 index.html 파일을 만듭니다.

index.html 파일은 다음을 기반으로합니다.
Swashbuckle/index.html at v5.5.3 · domaindrivendev/Swashbuckle
빌드 액션
index.html 속성에서 빌드 작업을 포함 리소스로 변경

참고
c# - swagger-ui returns 500 after deployment - Stack Overflow

How to customize Swagger UI in ASP.NET Web API – Umamaheswaran
ASP.NET Web API 2.2에서 Swagger (Swashbuckle 5.1.5) 사용 - BEACHSIDE BLOG
Reference
이 문제에 관하여(asp.net > swagger), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/sugasaki/items/a841a5a657f53b6522d2텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)