asp.net-core 2.0无法配置HTTPS端点

时间:2017-07-28 20:58:01

标签: c# asp.net linux

我在asp.net-core 2.0 preview1中开发了应用程序。我使用Visual Studio 2017在Windows上开发了它。

现在我想使用Docker将它部署到Linux服务器。

我在Windows上创建了Docker镜像。

Docker文件是:

resource

运行命令之后:

FROM microsoft/aspnetcore:2.0
ARG source
WORKDIR /app
EXPOSE 44305
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "Application.Web.dll"]

然后我用Docker在linux服务器上解析图像并运行它:

dotnet build -o obj/Docker/publish -c Release
dotnet publish -o obj/Docker/publish -c Release
docker build -t testapi-api .

但我收到错误:

docker run -p 44305:80 --name api testapi-api

我按照here的说明,但也不确定我是否做得很好。

尝试创建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 并将其添加到项目中,但似乎不起作用。

如果有人可以帮我解决在部署到linux服务器时如何使其工作的问题。

0 个答案:

没有答案