question

AbhishekPrajapati-9914 avatar image
0 Votes"
AbhishekPrajapati-9914 asked NicoleLu-9366 commented

ASP.NET Core: Unable to start Kestrel. An attempt was made to access a socket in a way forbidden by its permissions

I have an ASP.NET Core application running smoothly on IIS and suddenly it start throwing below error while running 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


I can see that the port this app is using is in Protocol tcp Port Exclusion Ranges. And I have tried changing port too but as soon as I change the port, new port is also added to this Protocol tcp Port Exclusion Ranges list.

I have tried below steps to fix this issue:
- Changed port
- Reboot system
- Removed port from Exclusion list but when tried to run app, it gets added again

I am not sure is it because of the latest windows security updates?

Does anyone know how to fix this issue?

Thanks,
Abhishek

dotnet-aspnet-core-mvc
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AbhishekPrajapati-9914, Did you update the windows system recently? Did you deploy and run exe successfully before? Is the port number same as run on the IIS?

0 Votes 0 ·

Hello @RenaNi-MSFT,

I can see my windows(local and Azure VM) got some security updates recently. Yes, I have deployed this app on IIS on Azure VM and it is running on same port. I tried changing port in IIS website but no luck, Still getting the same result - not working. When I change port in IIS, it gets added to this exclusion list.

0 Votes 0 ·
NicoleLu-9366 avatar image NicoleLu-9366 AbhishekPrajapati-9914 ·

Hi @AbhishekPrajapati-9914 this comment seems conflict with what you're saying in your questions. Please give some more clarifications:
1. Does your app work when deploy in IIS
2. Does your app work when run with exe
3. Are you deploy to IIS and run with exe on same computer e.g. your Azure VM?
4. Can you show us a screenshot of your Protocol tcp Port Exclusion Ranges? Also together with the port you've tried to use?
5. Can you share your windows security updates which is suspicious(a screenshot for the update list from the date you notice the issue) ?


0 Votes 0 ·
Show more comments

0 Answers