我正在尝试通过Visual Studio代码在Mac上运行ASP.NET MVC Web应用程序,并收到以下错误:-
使用'/Users/dhumes/development/aspnetdev/aspnetwebapp/Properties/launchSettings.json'[Profile'aspnetwebapp']中的启动设置...
信息:Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager [0]
用户个人资料可用。使用'/Users/dhumes/.aspnet/DataProtection-Keys'作为密钥存储库;密钥不会在静止时被加密。
暴击:Microsoft.AspNetCore.Server.Kestrel [0]
无法启动红est。
System.InvalidOperationException:无法配置HTTPS端点。未指定服务器证书,并且找不到默认的开发人员证书。
要生成开发者证书,请运行“ dotnet dev-certs https”。要信任证书(仅Windows和macOS),请运行“ dotnet dev-certs https --trust”。
有关配置HTTPS的更多信息,请参见https://go.microsoft.com/fwlink/?linkid=848054。
在Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions,操作1 configureOptions)
at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions)
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)处
在Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync [TContext](IHttpApplication 1 application, CancellationToken cancellationToken)
Unhandled Exception: System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found.
To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action
1 configureOptions)处
在Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions)
在Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext上下文)
在Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature地址,KestrelServerOptions服务器选项,ILogger记录器,Func 2 createBinding)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication
1应用程序,CancellationToken cancelledToken)处
在Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellingToken)
在Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost主机,CancellationToken令牌,字符串shutdownMessage)
在Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost主机,CancellationToken令牌)
在Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost主机)
在/Users/dhumes/development/aspnetdev/aspnetwebapp/Program.cs:line 17中的aspnetwebapp.Program.Main(String [] args)中
答案 0 :(得分:0)
尝试运行
dotnet开发人员证书https --trust
这将为本地主机安装本地证书。