티스토리 뷰
.NET 5, 6, 7
SocketException: An attempt was made to access a socket in a way forbidden by its access permissions
kaki104 2021. 8. 12. 11:50반응형
어제 저녁에 윈도우 업데이트가 있다고 해서 업데이트를 시키고, 아침에 작업할려고 서비스를 실행시켰는데 서비스에서 오류가 발생하네요
System.IO.IOException
HResult=0x80131620
Message=Failed to bind to address https://localhost:5001.
Source=Microsoft.AspNetCore.Server.Kestrel.Core
StackTrace:
at Microsoft.AspNetCore.Server.Kestrel.Core.LocalhostListenOptions.<BindAsync>d__2.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.<BindAsync>d__2.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindAsync>d__0.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<BindAsync>d__32.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<StartAsync>d__29`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.AspNetCore.Hosting.GenericWebHostService.<StartAsync>d__31.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>d__9.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at Golem.NFT.Service.Program.Main(String[] args) in C:\Users\kaki1\source\repos\MonsterFramework\Golem.NFT.Service\Program.cs:line 16
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
AggregateException: One or more errors occurred. (An attempt was made to access a socket in a way forbidden by its access permissions.) (An attempt was made to access a socket in a way forbidden by its access permissions.)
Inner Exception 2:
SocketException: An attempt was made to access a socket in a way forbidden by its access permissions.
갑자기 발생한 일이라 찾아보니
Solved - An attempt was made to access a socket in a way forbidden | Blog (ardalis.com)
내용을 보니 윈도우 업데이트 후에 특정 포트를 막아서 실행이 않된다고 하는군요 저도 포트를 확인해봤습니다.
C:\Users\kaki1>netsh interface ipv4 show excludedportrange protocol=tcp
Protocol tcp Port Exclusion Ranges
Start Port End Port
---------- --------
4521 4620
4621 4720
4821 4920
4921 5020
5022 5022
50000 50059 *
* - Administered port exclusions.
음..ASP.NET Core로 서비스를 만들면 기본 5000번이랑 5001번 사용하도록 설정되는데 4921-5020까지의 포트를 막아놓았네요;; 그래서 서비스의 포트를 변경하는 것이 제일 빠를것 같아서 5100, 5101번으로 변경했습니다.
포트번호를 수정하는 방법은 여기를 참고하세요
ASP.NET Core에서 Kestrel 웹 서버 구현 | Microsoft Docs
반응형
'.NET 5, 6, 7' 카테고리의 다른 글
Persistence Ignorance (지속성 무시) (0) | 2022.06.24 |
---|---|
.NET Framework 4.5.2, 4.6, 4.6.1 will reach End of Support on April 26, 2022 (0) | 2021.04.29 |
WinUI 3 - WebView 2 컨트롤 사용하는 데스크탑 앱 만들기 (0) | 2021.04.12 |
WinUI 3 - Project Reunion 0.5 안정화 버전 출시 (0) | 2021.04.09 |
Encapsulation (캡슐화) (0) | 2021.04.07 |
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Always Encrypted
- UWP
- dotNETconf
- IOT
- .net
- XAML
- Build 2016
- Behavior
- Windows 10
- Visual Studio 2022
- PRISM
- Microsoft
- #MVVM
- Cross-platform
- Bot Framework
- uno platform
- C#
- ef core
- #uwp
- .net 5.0
- WPF
- kiosk
- uno-platform
- #Windows Template Studio
- #prism
- windows 11
- ComboBox
- MVVM
- visual studio 2019
- LINQ
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함