1。 private readonly IWebHostEnvironment _hostingEnvironment;
2.
public HomeController(IWebHostEnvironment hostingEnvironment)
{
_hostingEnvironment = hostingEnvironment;
}
3. string webRootPath = _hostingEnvironment.WebRootPath;