最近、Operative System を Ubuntu 20.04 から KDE Neon 5.21 に変更しました。Rider IDE で .NET CORE 3.1.9 をインストールしました。
そのため、asp.net コア アプリを実行しようとすると、次の例外が発生します。
/home/toastedguy2/dotnet/dotnet /home/toastedguy2/Downloads/Food-Town/WebUI/bin/Debug/netcoreapp3.1/WebUI.dll
クリティカル: Microsoft.AspNetCore.Server.Kestrel[0]
Kestrel を起動できません。
System.InvalidOperationException: HTTPS エンドポイントを構成できません。サーバー証明書が指定されておらず、既定の開発者証明書が見つからないか、期限切れです。開発者証明書を生成するには、'dotnet dev-certs https' を実行してください。証明書を信頼するには (Windows と macOS のみ)、「dotnet dev-certs https --trust」を実行します。HTTPS の構成の詳細については、https://go.microsoft.com/fwlink/?linkid= 848054 を参照してください。
Windows または Ubuntu で発生したことがないため、何が起こっているのかわかりません。
私のprogram.csクラスのコードは次のとおりです。
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}
これが私のStartup.csファイルのコードです。
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddDbContextPool<FoodTownDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("Standard")));
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
}
PD: すべての asp.net コア アプリケーションで発生します。