プロジェクトの作成と実行
dotnet new blazorserver -o b01
cd b01
dotnet run
実行した時のメッセージ
$ dotnet run
ビルドしています...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:7096
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5018
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
データの変更
Pages/Index.razor
@page "/"
<PageTitle>Index</PageTitle>
<h1>こんにちは</h1>
Welcome to your new app.
<SurveyPrompt Title="How is Blazor working for you?" />
もう少し改造
Pages/Index.razor
@page "/"
<PageTitle>Index</PageTitle>
<h1>こんにちは</h1>
<p>Welcome to your new app.</p>
@hogehoge
@code {
String hogehoge = DateTime.Now.ToString();
}
<SurveyPrompt Title="How is Blazor working for you?" />
ポート番号の変更
次で受けるようにする
http://localhost:5000
https://localhost:5001
Properties/launchSettings.json
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:26896",
"sslPort": 44322
}
},
"profiles": {
"b01": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}