I developed application in asp.net-core 2.0 preview1. I developed it on windows with Visual Studio 2017.
Now I want to deploy it to Linux server using Docker.
I created Docker image on windows.
Docker file is:
FROM microsoft/aspnetcore:2.0
ARG source
WORKDIR /app
EXPOSE 44305
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "Application.Web.dll"]
After that running commands:
dotnet build -o obj/Docker/publish -c Release
dotnet publish -o obj/Docker/publish -c Release
docker build -t testapi-api .
Then I deplyoed image on linux server with Docker and run it:
docker run -p 44305:80 --name api testapi-api
But I am getting error:
Unhandled Exception: System.InvalidOperationException: Unable to configure HTTPS endpoint. For information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. ---> System.Collections.Generic.KeyNotFoundException: No certificate named 'HTTPS' found in configuration for the current environment (Production).
at Microsoft.AspNetCore.CertificateLoader.LoadSingle(String certificateName)
at Microsoft.AspNetCore.CertificateLoader.Load(IConfigurationSection certificateConfiguration)
at Microsoft.AspNetCore.KestrelServerOptionsSetup.<>c__DisplayClass6_0.<BindEndPoint>b__0(ListenOptions listenOptions)
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.KestrelServerOptionsSetup.<>c__DisplayClass6_0.<BindEndPoint>b__0(ListenOptions listenOptions)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions.Listen(IPEndPoint endPoint, Action`1 configure)
at Microsoft.AspNetCore.KestrelServerOptionsSetup.BindEndPoint(KestrelServerOptions options, IConfigurationSection endPoint, CertificateLoader certificateLoader)
at Microsoft.AspNetCore.KestrelServerOptionsSetup.BindConfiguration(KestrelServerOptions options)
at Microsoft.Extensions.Options.LegacyOptionsCache`1.CreateOptions()
at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.CreateServiceContext(IOptions`1 options, ILoggerFactory loggerFactory)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer..ctor(IOptions`1 options, ITransportFactory transportFactory, ILoggerFactory loggerFactory)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureServer()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at XTrader.Web.Program.Main(String[] args) in C:\wamp64\www\app\Application.Web\Program.cs:line 17
I followed instructions from here, but nor sure if I did everything fine.
Tried to create certificate.pfx and add it to project but that doesn't seems to work.
If someone can help me to figure out how to get it working in this case when deploying to linux server.