プロジェクトを作成した直後のデフォルトの状態で、エラーが起きた時の備忘録
状況①
- Visual Studio for MAC バージョン8.3
- .NET Core3.0 MVC (プロジェクトの作成直後)
- 2019年11月28日時点
ふと、C#でプログラムを書いてみたくなり、.NET Core 3.0 プロジェクトを新規作成し、GUIでビルドすると、起動するはずのブラウザが起動しなかった。
.csprojファイルをいじったりと無駄な努力をしてみたが、結局解決せず。
dotnet コマンドでビルドを行い、ログから開いているポート番号を確認した。

localhost:5000 にアクセスし、アプリが起動していることを確認できた。
どのポートを開くかは、launch.jsonで設定できるっぽい
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:20286", "sslPort": 44369 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "dotnet_sample": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "https://localhost:5001;http://localhost:5000" } } } |
状況②
プロジェクト作成後のデフォルト時に怒る時のエラーです。
<code>dotnet run</code>
の後に証明書がないというエラーが出る。
1 2 3 4 5 |
>>> dotnet run crit: Microsoft.AspNetCore.Server.Kestrel[0] 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'. |
.NET Coreプロジェクトの作成時にHTTPS/HSTS をオプトアウトする必要があります。
Leave a Reply