Код: Выделить всё
System.InvalidOperationException: Cannot find the fallback endpoint specified by route values: { page: /_Host, area: }.
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DynamicPageEndpointMatcherPolicy.ApplyAsync(HttpContext httpContext, CandidateSet candidates)
at Microsoft.AspNetCore.Routing.Matching.DfaMatcher.SelectEndpointWithPoliciesAsync(HttpContext httpContext, IEndpointSelectorPolicy[] policies, CandidateSet candidateSet)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.g__AwaitMatch|10_1(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task matchTask)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
Код: Выделить всё
false
`
Может быть, кто-нибудь скажет мне, в чем моя ошибка, и поможет мне ее решить.
_Host.cshtml:
Код: Выделить всё
@page "/"
@namespace Berhub
@using Berhub.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = null;
}
BERHub
Код: Выделить всё
using Berhub;
using Berhub.Models;
using berhub.Components;
using Dapper;
using Berhub.DataAccessLayer.DataAccessLayer;
using Berhub.DataAccessLayer.SqlDataAccess;
using Radzen;
using Radzen.Blazor;
using Microsoft.Extensions.DependencyInjection;
using Berhub.DataAccessLayer.Repositories;
using Microsoft.AspNetCore.Authentication.Negotiate;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Configuration;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.Services.AddRadzenComponents();
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
var configuration = builder.Configuration;
builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme).AddNegotiate(); // Windows authentication may not be applied with Kestrel without this line
builder.Services.AddAuthorization(
options =>{
options.AddPolicy("KeyUsers", policy =>
policy.RequireRole(configuration.GetSection("ActiveDirectory")["KeyUsers"]));
});
/**builder.Services.AddRazorPages(options =>
{
options.RootDirectory = "/Components";
});**/
builder.Services.AddServerSideBlazor();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAntiforgery();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapRazorPages();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host"); // Pfad zur _Host.cshtml anpassen
app.Run();
Код: Выделить всё
@page "/"
@attribute [StreamRendering]
Home
Anmelden
Benutzername:
Passwort:
Подробнее здесь: https://stackoverflow.com/questions/791 ... k-endpoint
Мобильная версия