启动.net核心应用程序时出现问题。无法在端口80上启动Kestrel

时间:2019-09-23 13:34:47

标签: c# .net asp.net-core

当我尝试在端口80上启动应用程序时,出现错误。

我试图在其他端口上启动该应用程序,但它可以正常工作,但是当我选择端口<1100时,它会出现一些问题。

我使用以下命令:

dotnet appname.dll --urls =“ http:// localhost:80”

错误看起来像这样:

  

Microsoft.AspNetCore.Server.Kestrel [0]        无法绑定到IPv4环回接口上的http://localhost:80:“权限被拒绝”。   警告:Microsoft.AspNetCore.Server.Kestrel [0]        无法绑定到IPv6环回接口上的http://localhost:80:“权限被拒绝”。   暴击:Microsoft.AspNetCore.Server.Kestrel [0]        无法启动红est。   System.IO.IOException:无法绑定到地址http://localhost:80。 ---> System.AggregateException:发生一个或多个错误。 (权限被拒绝)(权限被拒绝)---> System.Net.Sockets.SocketException:权限被拒绝     在System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError错误,字符串调用者名称)     在System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot,SocketAddress socketAddress)     在System.Net.Sockets.Socket.Bind(Endpoint localEP)     在Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransport.BindAsync()     在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.LocalhostListenOptions.BindAsync(AddressBindContext context) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at Microsoft.AspNetCore.Server.Kestrel.Core.LocalhostListenOptions.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)。     在Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync [TContext](IHttpApplication`1应用程序,CancellationToken cancelledToken)

     

未处理的异常:System.IO.IOException:无法绑定到地址http://localhost:80。 ---> System.AggregateException:发生一个或多个错误。 (权限被拒绝)(权限被拒绝)---> System.Net.Sockets.SocketException:权限被拒绝     在System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError错误,字符串调用者名称)     在System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot,SocketAddress socketAddress)     在System.Net.Sockets.Socket.Bind(Endpoint localEP)     在Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransport.BindAsync()   v在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.LocalhostListenOptions.BindAsync(AddressBindContext context) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at Microsoft.AspNetCore.Server.Kestrel.Core.LocalhostListenOptions.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)     在Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync [TContext](IHttpApplication`1应用程序,CancellationToken cancelToken)     在Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellingToken)    在Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost主机,CancellationToken令牌,字符串shutdownMessage)    在Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost主机,CancellationToken令牌)    在Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost主机)上

1 个答案:

答案 0 :(得分:0)

此问题的解决方案是@JonasMH评论。 “您是否尝试过在管理员控制台中运行?” 它对我有用!