Pin*_*ong 8 c# kestrel-http-server
当指定要绑定的端口时,.UseKestrel()我得到下面列出的错误..但是如果我删除 kestrel 选项,如果我从浏览器检查 API,一切正常。
我尝试绑定到我的应用程序默认使用的端口而不选择netstat任何端口,并且我尝试检查以主动避免任何正在使用的端口。除了完全删除选项外,什么都不起作用。这不会在我的 Mac 或另一台 Windows 10 机器上复制。此设备是 Windows 10。
.UseKestrel(options =>
{
options.Listen(IPAddress.Loopback, 50470);
options.Listen(IPAddress.Any, 80);
})
: Microsoft.AspNetCore.Server.Kestrel[0]
Overriding address(es) 'http://localhost:50470/'. Binding to endpoints defined
in UseKestrel() instead.
crit: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to start Kestrel.
System.Net.Sockets.SocketException (10013): An attempt was made to access a
socket in a way forbidden by its access permissions
at
System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException
(SocketError error, String callerName)
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress
socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransport.
BindAsync() at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.
<>c__DisplayClass21_01.<<StartAsync>g__OnBind|0>d.MoveNext() `
Run Code Online (Sandbox Code Playgroud)
小智 6
Windows Update 后,某些端口被 Windows 保留,应用程序无法绑定到这些端口。请检查此命令以了解操作系统上的禁止端口
netsh 接口 ipv4 显示排除的端口范围协议=tcp
| 归档时间: |
|
| 查看次数: |
13308 次 |
| 最近记录: |