1.Controllerの追加
Controllerフォルダーの下に、次のようなファイル(SampleController.cs)を作成します
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using AspNetCoreSample.Models;
namespace AspNetCoreSample.Controllers
{
public class SampleController : Controller
{
public string Index()
{
return "This is my Sample";
}
}
}
2.実行
> dotnet run で実行し
http://localhost:5000/Sample
にアクセスすると
This is my Sample
が表示されます
0 件のコメント:
コメントを投稿