我的应用程序已部署到运行 dotnet core 3.1.2 的 Azure App Service 。 (已安装扩展程序)
连接到Kudo控制台并运行dotnet Reporting.API.dll
时,输出为:
dotnet Reporting.API.dll
[09:53:21 DBG] Hosting starting
[09:53:25 INF] Azure Web Sites environment detected. Using 'D:\home\ASP.NET\DataProtection-Keys' as key repository; keys will not be encrypted at rest.
[09:53:25 INF] Starting the processing server.
[09:53:25 DBG] Reading data from file 'D:\home\ASP.NET\DataProtection-Keys\key-9d61e53e-50f6-48c2-9fb1-76edd2ec884c.xml'.
[09:53:25 DBG] Reading data from file 'D:\home\ASP.NET\DataProtection-Keys\key-9f563cfe-7cea-4332-8010-c2e0c485ee39.xml'.
[09:53:25 DBG] Reading data from file 'D:\home\ASP.NET\DataProtection-Keys\key-a4632346-de3c-4726-b84d-067511ba48de.xml'.
[09:53:25 DBG] Reading data from file 'D:\home\ASP.NET\DataProtection-Keys\key-cbf59895-b970-4cbf-aad1-eb4387edb6ab.xml'.
[09:53:25 DBG] Reading data from file 'D:\home\ASP.NET\DataProtection-Keys\key-f5be7258-dbc8-4f36-8f3e-930073d353b2.xml'.
[09:53:25 DBG] Found key {9d61e53e-50f6-48c2-9fb1-76edd2ec884c}.
[09:53:25 DBG] Found key {9f563cfe-7cea-4332-8010-c2e0c485ee39}.
[09:53:25 DBG] Found key {a4632346-de3c-4726-b84d-067511ba48de}.
[09:53:25 DBG] Found key {cbf59895-b970-4cbf-aad1-eb4387edb6ab}.
[09:53:25 DBG] Found key {f5be7258-dbc8-4f36-8f3e-930073d353b2}.
[09:53:25 DBG] Considering key {a4632346-de3c-4726-b84d-067511ba48de} with expiration date 2020-05-26 16:44:50Z as default key.
[09:53:25 DBG] Opening CNG algorithm 'AES' from provider 'null' with chaining mode CBC.
Unhandled exception.[09:53:25 DBG] Opening CNG algorithm 'SHA256' from provider 'null' with HMAC.
[09:53:25 DBG] Using key {a4632346-de3c-4726-b84d-067511ba48de} as the default key.
[09:53:25 DBG] Key ring with default key {a4632346-de3c-4726-b84d-067511ba48de} was loaded during application startup.
[09:53:25 DBG] Failed to locate the development https certificate at 'null'.
[09:53:25 DBG] Unable to locate an appropriate development https certificate.
[09:53:25 FTL] Unable to start Kestrel.
System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
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)
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)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
[09:53:25 DBG] Hosting shutdown
[09:53:25 INF] Queued Hosted Service is stopping.
System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
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)
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)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
at Reporting.API.Program.Main(String[] args) in C:\agent-02\_work\35\s\src\Reporting.API\Program.cs:line 19
我的Startup.cs
非常标准:
public void Configure(IApplicationBuilder app)
{
app.UseCors("CorsPolicy");
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseMvc();
}
有什么想法吗?
更新:
我已经从Configure方法中删除了app.UseHttpsRedirection();
。
出于澄清目的:仅HTTPS 设置为true