Прямо сейчас как только я запускаю индексную страницу, появляется сообщение:
Эта страница локального хоста не найдена — для данного веб-адреса не найдена веб-страница.
Код моего домашнего контроллера для индекса можно найти ниже,
Код: Выделить всё
public class HomeController : Controller
{
private readonly ILogger _logger;
public HomeController(ILogger logger)
{
_logger = logger;
}
public IActionResult Index()
{
return View("Index");
}
public IActionResult Privacy()
{
return View();
}
Код: Выделить всё
{
"ConnectionStrings": {
"DefaultConnection": ";Database={Employees};User Id={Ammadlogin};Password={ammadpass1}Trust Server Certificate=True;"
},
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*"
}
Код: Выделить всё
using Microsoft.EntityFrameworkCore;
namespace Employeeproject
{
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.Run();
// Add services to the container.
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddDbContext(options =>
options.UseSqlServer(connectionString));
builder.Services.AddControllersWithViews();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... eb-address