ASP.NET Core:无法启动 Kestrel试图以权限禁止的方式访问套接字

问题描述

我有一个 ASP.NET Core 应用程序在 IIS 上流畅运行,但在运行 EXE 时突然开始抛出以下错误

[23:14:04 FTL] 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.socketConnectionListener.Bind()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.sockets.socketTransportFactory.BindAsync(EndPoint endpoint,CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<>c__displayClass21_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from prevIoUs location where exception was thrown ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(Listenoptions endpoint,AddressBindContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Listenoptions.BindAsync(AddressBindContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.AnyIPListenoptions.BindAsync(AddressBindContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.Addressesstrategy.BindAsync(AddressBindContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature addresses,KestrelServerOptions serverOptions,ILogger logger,Func`2 createBinding)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application,CancellationToken cancellationToken)
[23:14:04 FTL] Api host terminated unexpectedly

我可以看到此应用使用的端口位于 Protocol tcp Port Exclusion Ranges。我也尝试过更改端口,但是一旦更改端口,新端口也会添加到此 Protocol tcp Port Exclusion Ranges 列表中。

我已尝试以下步骤来解决此问题:

  • 更改端口
  • 重启系统
  • 已从排除列表中删除端口,但当尝试运行应用程序时,它又被添加

我不确定是不是因为最新的 Windows 安全更新?

有人知道如何解决这个问题吗?

谢谢, 阿布舍克

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...