question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

crit: Microsoft.AspNetCore.Server.Kestrel[0] Unable to start Kestrel

See original GitHub issue

I developed my asp.net core application in windows, and move to a container where it is working perfectly in my local environment with https. But now i want to run my application with https in Ubuntu 18.04, but i am getting error, i am providing our own certificate but it is not working. The error is given below. I am running applications via docker-compose. Docker-compose and other required files are also given below. Please help me to solve this issue

> WebPortal      | Unhandled Exception: Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file
WebPortal      |    at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle)
WebPortal      |    at Internal.Cryptography.Pal.CertificatePal.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
WebPortal      |    at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
WebPortal      |    at TT.Core.Web.Program.<>c__DisplayClass1_0.<CreateWebHostBuilder>b__1(ListenOptions listenOptions) in /src/TT.Core.Web/Program.cs:line 56
WebPortal      |    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions.Listen(IPEndPoint endPoint, Action`1 configure)
WebPortal      |    at TT.Core.Web.Program.<>c.<CreateWebHostBuilder>b__1_0(KestrelServerOptions options) in /src/TT.Core.Web/Program.cs:line 68
WebPortal      |    at Microsoft.Extensions.Options.ConfigureNamedOptions`1.Configure(String name, TOptions options)
WebPortal      |    at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
WebPortal      |    at Microsoft.Extensions.Options.OptionsManager`1.<>c__DisplayClass5_0.<Get>b__0()
WebPortal      |    at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
WebPortal      |    at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
WebPortal      |    at System.Lazy`1.CreateValue()
WebPortal      |    at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd(String name, Func`1 createOptions)
WebPortal      |    at Microsoft.Extensions.Options.OptionsManager`1.Get(String name)
WebPortal      |    at Microsoft.Extensions.Options.OptionsManager`1.get_Value()
WebPortal      |    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.CreateServiceContext(IOptions`1 options, ILoggerFactory loggerFactory)
WebPortal      |    at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer..ctor(IOptions`1 options, ITransportFactory transportFactory, ILoggerFactory loggerFactory)
WebPortal      | --- End of stack trace from previous location where exception was thrown ---
WebPortal      |    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
WebPortal      |    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
WebPortal      |    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
WebPortal      |    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope)
WebPortal      |    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
WebPortal      |    at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
WebPortal      |    at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
WebPortal      |    at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType)
WebPortal      |    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
WebPortal      |    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
WebPortal      |    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
WebPortal      |    at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureServer()
WebPortal      |    at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
WebPortal      |    at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
WebPortal      |    at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage)
WebPortal      |    at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
WebPortal      |    at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
WebPortal      |    at TT.Core.Web.Program.Main(String[] args) in /src/TT.Core.Web/Program.cs:line 32
WebPortal exited with code 139



Docker-compose.yml

version: ‘3.4’

services:

tt.core.web:

image: thingtraxcontainerregistry.azurecr.io/ttcoreweb

container_name: WebPortal

environment:

  CORE_ENVIRONMENT: ${env}

  ASPNETCORE_ENVIRONMENT: ${env}

  IsDockerDeployment: ${isDockerDeployment}

restart: always

networks:

 - app-network

networks:

app-network:

ipam:

  driver: default

  config:

    - subnet: 172.24.0.0/16

docker-compose.override.yml

version: ‘3.4’

services:

tt.core.web:

environment:

  - ASPNETCORE_ENVIRONMENT=${env}

  - IsDockerDeployment=${isDockerDeployment}

  - ASPNETCORE_URLS=https://+:443;http://+:80

  - ASPNETCORE_HTTPS_PORT=443

  - KestrelPath=${appCertificate}

  - KestrelPassword=${appCertificatepassword}

  - ASPNETCORE_Kestrel__Certificates__Default__Password=doaminnamepassword

  - ASPNETCORE_Kestrel__Certificates__Default__Path=/root/.aspnet/https/_.domainname.com_private_key.pfx

ports:

  - "80:80"

  - "443:443"

volumes:

  - /home/thingtrax/Downloads/DockerComposelinux/DockerCompose/config:/root/.aspnet/https:ro

  - /home/thingtrax/Downloads/DockerComposelinux/DockerCompose/config:/root/.microsoft/usersecrets:ro

.env file

env=devdocker isDockerDeployment=true appCertificate=/root/.aspnet/https/_.domainname.com_private_key.pfx appCertificatepassword=doaminnamepassword.123!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bilalmalik777commented, Sep 16, 2020

The problem has been resolved by following your last recommendation regarding app-settings @Tratcher @halter73 I am grateful for your support.

1reaction
halter73commented, Sep 15, 2020

It’s wherever your configuration is defined. https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1

CreateDefaultBuilder will load config from appsettings.json and appsettings.{Environment}.json by default.

Read more comments on GitHub >

github_iconTop Results From Across the Web

crit: Microsoft.AspNetCore.Server.Kestrel[0] Unable to start ...
crit: Microsoft.AspNetCore.Server.Kestrel[0] Unable to start Kestrel. System.InvalidOperationException: Unable to configure HTTPS endpoint.
Read more >
Unable to start Kestrel. Failed to bind to address ...
I want to start a .net core application from an API that I created which is ... AspNetCore.Server.Kestrel[0]\r\n Unable to start Kestrel.
Read more >
ASP.NET Core: Unable to start Kestrel. An attempt was ...
I have an ASP.NET Core application running smoothly on IIS and suddenly it start throwing below error while running EXE.
Read more >
Unable to start kestrel in visual studio code – BLOG
NET MVC project in VS Code and trying to run project after successfully build . You might see below error. It require https...
Read more >
Unable to start Kestrel getting 'An attempt was made ...
I ran into this error when trying to run a Bot Framework bot sample by Microsoft. Turns out I just had another bot...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found