성태의 닷넷 이야기
홈 주인
모아 놓은 자료
프로그래밍
질문/답변
사용자 관리
사용자
메뉴
아티클
외부 아티클
유용한 코드
온라인 기능
MathJax 입력기
최근 덧글
[정성태] 그냥 RSS Reader 기능과 약간의 UI 편의성 때문에 사용...
[이종효] 오래된 소프트웨어는 보안 위협이 되기도 합니다. 혹시 어떤 기능...
[정성태] @Keystroke IEEE의 문서를 소개해 주시다니... +_...
[손민수 (Keystroke)] 괜히 듀얼채널 구성할 때 한번에 같은 제품 사라고 하는 것이 아...
[정성태] 전각(Full-width)/반각(Half-width) 기능을 토...
[정성태] Vector에 대한 내용은 없습니다. Vector가 닷넷 BCL...
[orion] 글 읽고 찾아보니 디자인 타임에는 InitializeCompon...
[orion] 연휴 전에 재현 프로젝트 올리자 생각해 놓고 여의치 않아서 못 ...
[정성태] 아래의 글에 정리했으니 참고하세요. C# - Typed D...
[정성태] 간단한 재현 프로젝트라도 있을까요? 저런 식으로 설명만 해...
글쓰기
제목
이름
암호
전자우편
HTML
홈페이지
유형
제니퍼 .NET
닷넷
COM 개체 관련
스크립트
VC++
VS.NET IDE
Windows
Team Foundation Server
디버깅 기술
오류 유형
개발 환경 구성
웹
기타
Linux
Java
DDK
Math
Phone
Graphics
사물인터넷
부모글 보이기/감추기
내용
<div style='display: inline'> <h1 style='font-family: Malgun Gothic, Consolas; font-size: 20pt; color: #006699; text-align: center; font-weight: bold'>System.InvalidOperationException - Unable to configure HTTPS endpoint</h1> <p> 간혹 asp.net core에서 Https 사용 시 다음과 같은 예외가 발생할 수 있습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > System.InvalidOperationException HResult=0x80131509 Message=Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found. To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'. For more information on configuring HTTPS see <a target='tab' href='https://go.microsoft.com/fwlink/?linkid=848054'>https://go.microsoft.com/fwlink/?linkid=848054</a>. Source=Microsoft.AspNetCore.Server.Kestrel.Core StackTrace: at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action`1 configureOptions) in /_/src/Kestrel.Core/ListenOptionsHttpsExtensions.cs:line 185 </pre> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > public static ListenOptions UseHttps(this ListenOptions listenOptions, Action<HttpsConnectionAdapterOptions> configureOptions) { if (configureOptions == null) { throw new ArgumentNullException(nameof(configureOptions)); } var options = new HttpsConnectionAdapterOptions(); listenOptions.KestrelServerOptions.ApplyHttpsDefaults(options); configureOptions(options); listenOptions.KestrelServerOptions.ApplyDefaultCert(options); if (options.ServerCertificate == null && options.ServerCertificateSelector == null) { <span style='color: blue; font-weight: bold'>throw new InvalidOperationException(CoreStrings.NoCertSpecifiedNoDevelopmentCertificateFound);</span> } return listenOptions.UseHttps(options); } </pre> <br /> 직접적인 원인은, "<a target='tab' href='https://www.sysnet.pe.kr/2/0/13235'>subjectAltName</a>"으로 "localhost" 이름의 "신뢰할 수 있는 인증서"가 없기 때문입니다.<br /> <br /> 대부분의 경우에는, (정확히 언제 생성되는지는 모르겠지만) 아마도 Visual Studio가 자동으로 localhost 인증서를 생성해 두기 때문에 별문제가 없습니다. 하지만, 이것이 만료돼 비주얼 스튜디오가 인증서를 갱신하는 그 사이에 위와 같은 문제를 만날 수 있습니다.<br /> <br /> <hr style='width: 50%' /><br /> <a name='aspnet_cert'></a> <br /> 해결 방법은 비주얼 스튜디오의 도움 없이 임의로도 가능합니다. 정상적인 상황이라면, 현재 여러분의 PC에는 다음의 2가지 위치에 각각 Friendly Name == "ASP.NET Core HTTPS development certificate"인 인증서가 있을 것입니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > Personal "ASP.NET Core HTTPS development certificate" "Trusted Root Certification Authorities" "ASP.NET Core HTTPS development certificate" </pre> <br /> 아래는 인증서 관리자를 통해 Personal에 있는 인증서를 확인한 것입니다.<br /> <br /> <img onclick='toggle_img(this)' class='imgView' alt='dotnet_dev_cert_1.png' src='/SysWebRes/bbs/dotnet_dev_cert_1.png' /><br /> <br /> 위의 그림에서 2개의 "localhost" 인증서를 확인할 수 있는데, 비주얼 스튜디오가 1년의 만료 기간을 갖는 인증서를 생성하므로 저렇게 1년 단위로 쌓이게 됩니다.<br /> <br /> 우선 해당 인증서를 지우려면 dotnet 명령어를 이용할 수 있습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > // 관리자 권한의 cmd.exe 환경에서 실행 c:\temp> <span style='color: blue; font-weight: bold'>dotnet dev-certs https --clean</span> A valid HTTPS certificate is already present. </pre> <br /> 물론, 새로 생성하는 것도 매우 쉽습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > c:\temp> <span style='color: blue; font-weight: bold'>dotnet dev-certs https --trust</span> </pre> <br /> 왠지 1년마다 갱신되는 것이 마음에 들지 않는다면 그냥 만료 기간을 길게 잡은 인증서를 직접 생성해 등록해도 됩니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > openssl을 이용해 인트라넷 IIS 사이트의 SSL 인증서 생성 ; <a target='tab' href='https://www.sysnet.pe.kr/2/0/13236'>https://www.sysnet.pe.kr/2/0/13236</a> </pre> </p><br /> <br /><hr /><span style='color: Maroon'>[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]</span> </div>
첨부파일
스팸 방지용 인증 번호
2788
(왼쪽의 숫자를 입력해야 합니다.)