プロジェクトの作成
mkdir Mvc01
cd Mvc01
dotnet new mvc
$ dotnet new mvc
The template "ASP.NET Core Web App (Model-View-Controller)" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/aspnetcore/3.0-third-party-notices for details.
Processing post-creation actions...
Running 'dotnet restore' on /home/uchida/tmp/Mvc01/Mvc01.csproj...
/home/uchida/tmp/Mvc01/Mvc01.csproj の復元が 504.67 ms で完了しました。
Restore succeeded.
次の2つのファイルを修正します。
1) localhost 以外からもアクセスできるようにします。
appsettings.Development.json
{"urls":"http://*:5000","Logging":{"LogLevel":{"Default":"Debug","System":"Information","Microsoft":"Information"}}}2) 表示に日本語を入れてみます。
Views/Home/Index.cshtml
{
ViewData["Title"] = "Home Page";
}
<divclass="text-center"><h1class="display-4">Welcome</h1><p>Learn about <ahref="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p><p> Hello Everybody!</p><p>こんにちは</p></div>コンパイルと実行
dotnet run
ブラウザーで http://host:5000/にアクセス