Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

System.Net.Sockets.SocketException Starting Kestrel to Serve MyCompanyName.Web.Host #7016


User avatar
0
rnguyen created

Using the following batch file, ran as Administrator on Windows Server 2019 with Firewall turned of for private networks:

@echo off mode con: cols=120 lines=5 echo Starting Web.Host... CD /D "D:\AIXEM_CRM_6.8\Ver_6_8\src\Aixem.Web.Host"

SET ASPNETCORE_ENVIRONMENT=Development SET ASPNETCORE_URLS=http://*:22742 dotnet run

The following exception in thrown:

Starting Web.Host...

Unhandled Exception: System.Net.Sockets.SocketException: 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() --- 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, Func2 createBinding) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken) at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken) at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage) at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token) at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host) at Aixem.Web.Startup.Program.Main(String[] args) in D:\AIXEM_CRM_6.8\Ver_6_8\src\Aixem.Web.Host\Startup\Program.cs:line 10

Here are the contents of Log.txt:

DEBUG 2019-05-15 20:31:43,618 [1 ] Abp.Modules.AbpModuleManager - Loading Abp modules... DEBUG 2019-05-15 20:31:43,650 [1 ] Abp.Modules.AbpModuleManager - Found 24 ABP modules in total. DEBUG 2019-05-15 20:31:43,680 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Aixem.Web.Startup.AixemWebHostModule, Aixem.Web.Host, Version=6.5.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,683 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Aixem.Web.AixemWebCoreModule, Aixem.Web.Core, Version=6.5.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,684 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Aixem.AixemApplicationModule, Aixem.Application, Version=6.5.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,684 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Aixem.AixemCoreModule, Aixem.Core, Version=6.5.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,685 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.AbpZeroCoreModule, Abp.ZeroCore, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,685 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.AbpZeroCommonModule, Abp.Zero.Common, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,686 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AbpKernelModule, Abp, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,686 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.Ldap.AbpZeroLdapModule, Abp.Zero.Ldap, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,687 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AutoMapper.AbpAutoMapperModule, Abp.AutoMapper, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,688 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AspNetZeroCore.AbpAspNetZeroCoreModule, Abp.AspNetZeroCore, Version=1.2.2.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,688 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.MailKit.AbpMailKitModule, Abp.MailKit, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,688 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Aixem.EntityFrameworkCore.AixemEntityFrameworkCoreModule, Aixem.EntityFrameworkCore, Version=6.5.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,689 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.EntityFrameworkCore.AbpZeroCoreEntityFrameworkCoreModule, Abp.ZeroCore.EntityFrameworkCore, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,689 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.EntityFrameworkCore.AbpEntityFrameworkCoreModule, Abp.EntityFrameworkCore, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,689 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.EntityFramework.AbpEntityFrameworkCommonModule, Abp.EntityFramework.Common, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,689 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.IdentityServer4.AbpZeroCoreIdentityServerEntityFrameworkCoreModule, Abp.ZeroCore.IdentityServer4.EntityFrameworkCore, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,689 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.IdentityServer4.AbpZeroCoreIdentityServerModule, Abp.ZeroCore.IdentityServer4, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,690 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AspNetZeroCore.Web.AbpAspNetZeroCoreWebModule, Abp.AspNetZeroCore.Web, Version=1.2.2.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,690 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AspNetCore.AbpAspNetCoreModule, Abp.AspNetCore, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,690 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Web.AbpWebCommonModule, Abp.Web.Common, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,690 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AspNetCore.SignalR.AbpAspNetCoreSignalRModule, Abp.AspNetCore.SignalR, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,691 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Aixem.Startup.AixemGraphQLModule, Aixem.GraphQL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,691 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Runtime.Caching.Redis.AbpRedisCacheModule, Abp.RedisCache, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,691 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Hangfire.AbpHangfireAspNetCoreModule, Abp.HangFire.AspNetCore, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:43,695 [1 ] Abp.Modules.AbpModuleManager - 24 modules loaded. DEBUG 2019-05-15 20:31:43,781 [1 ] o.Configuration.LanguageManagementConfig - Converted Abp (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource DEBUG 2019-05-15 20:31:43,781 [1 ] o.Configuration.LanguageManagementConfig - Converted AbpZero (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource DEBUG 2019-05-15 20:31:43,781 [1 ] o.Configuration.LanguageManagementConfig - Converted Aixem (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource DEBUG 2019-05-15 20:31:43,781 [1 ] o.Configuration.LanguageManagementConfig - Converted AbpWeb (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource DEBUG 2019-05-15 20:31:44,168 [1 ] ameworkCore.AbpEntityFrameworkCoreModule - Registering DbContext: Aixem.EntityFrameworkCore.AixemDbContext, Aixem.EntityFrameworkCore, Version=6.5.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2019-05-15 20:31:44,634 [1 ] Abp.Localization.LocalizationManager - Initializing 4 localization sources. DEBUG 2019-05-15 20:31:44,662 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: Abp DEBUG 2019-05-15 20:31:44,671 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: AbpZero DEBUG 2019-05-15 20:31:44,698 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: Aixem DEBUG 2019-05-15 20:31:44,702 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: AbpWeb DEBUG 2019-05-15 20:31:44,732 [1 ] Abp.BackgroundJobs.BackgroundJobManager - Start background worker: Abp.BackgroundJobs.BackgroundJobManager DEBUG 2019-05-15 20:31:44,775 [1 ] Abp.AutoMapper.AbpAutoMapperModule - Found 6 classes define auto mapping attributes DEBUG 2019-05-15 20:31:44,775 [1 ] Abp.AutoMapper.AbpAutoMapperModule - Aixem.Web.Models.TokenAuth.ExternalLoginProviderInfoModel DEBUG 2019-05-15 20:31:44,781 [1 ] Abp.AutoMapper.AbpAutoMapperModule - Aixem.Friendships.Cache.FriendCacheItem DEBUG 2019-05-15 20:31:44,781 [1 ] Abp.AutoMapper.AbpAutoMapperModule - Aixem.Dto.OrganizationUnitDto DEBUG 2019-05-15 20:31:44,781 [1 ] Abp.AutoMapper.AbpAutoMapperModule - Aixem.Dto.RoleDto DEBUG 2019-05-15 20:31:44,782 [1 ] Abp.AutoMapper.AbpAutoMapperModule - Aixem.Dto.UserDto+RoleDto DEBUG 2019-05-15 20:31:44,782 [1 ] Abp.AutoMapper.AbpAutoMapperModule - Aixem.Dto.UserDto+OrganizationUnitDto DEBUG 2019-05-15 20:31:49,134 [1 ] enancy.SubscriptionExpirationCheckWorker - Start background worker: Aixem.MultiTenancy.SubscriptionExpirationCheckWorker DEBUG 2019-05-15 20:31:49,137 [1 ] cy.SubscriptionExpireEmailNotifierWorker - Start background worker: Aixem.MultiTenancy.SubscriptionExpireEmailNotifierWorker FATAL 2019-05-15 20:31:50,032 [1 ] Microsoft.AspNetCore.Server.Kestrel - 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.&lt;&lt;StartAsync&gt;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, Func2 createBinding) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken) DEBUG 2019-05-15 20:31:50,067 [1 ] Abp.Modules.AbpModuleManager - Shutting down has been started DEBUG 2019-05-15 20:31:50,068 [1 ] Abp.BackgroundJobs.BackgroundJobManager - Stop background worker: Abp.BackgroundJobs.BackgroundJobManager DEBUG 2019-05-15 20:31:50,068 [1 ] enancy.SubscriptionExpirationCheckWorker - Stop background worker: Aixem.MultiTenancy.SubscriptionExpirationCheckWorker DEBUG 2019-05-15 20:31:50,068 [1 ] cy.SubscriptionExpireEmailNotifierWorker - Stop background worker: Aixem.MultiTenancy.SubscriptionExpireEmailNotifierWorker DEBUG 2019-05-15 20:31:50,069 [1 ] Abp.BackgroundJobs.BackgroundJobManager - WaitToStop background worker: Abp.BackgroundJobs.BackgroundJobManager DEBUG 2019-05-15 20:31:50,069 [1 ] enancy.SubscriptionExpirationCheckWorker - WaitToStop background worker: Aixem.MultiTenancy.SubscriptionExpirationCheckWorker DEBUG 2019-05-15 20:31:50,069 [1 ] cy.SubscriptionExpireEmailNotifierWorker - WaitToStop background worker: Aixem.MultiTenancy.SubscriptionExpireEmailNotifierWorker DEBUG 2019-05-15 20:31:50,069 [1 ] Abp.Modules.AbpModuleManager - Shutting down completed.

Note: if I comment out the line in the batch file containing SET ASPNETCORE_URLS=http://*:22742 Kestrel starts fine but on localhost:5000 which of course doesn't allow remote access which is what I need to test the Xamarin mobile app where the iOS Simulater is remoted from the Mac.

Any idea why this is happening?

Thanks


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Try another port?
    For example: SET ASPNETCORE_URLS=http://*:22740

    If the replacement port can be solved, please check if port 22742 is occupied by other programs.