Blazored-modal.css not loaded properly when the app start

2.2k views Asked by At

My Blazor app has some problem with Blazored-modal. If i try to show a modal pop as soon as someone visit the app, the modal pop up is not showed correctly and the console show this message:

Failed to load resource: the server responded with a status of 404 (Not Found) blazored-modal.css:1 

Any other popup is correctly showed and the error message is no more present in the console.

All is setted properly:

Configuredservices:

public void ConfigureServices(IServiceCollection services)
    {
        services.AddRazorPages();
        services.AddServerSideBlazor();
        services.AddSingleton<WeatherForecastService>();
        services.AddBlazoredModal();
    }

_Imports:

@using Blazored.Modal
@using Blazored.Modal.Services

App.razor:

<CascadingBlazoredModal>
<Router AppAssembly="@typeof(Program).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
    </Found>
    <NotFound>
        <LayoutView Layout="@typeof(MainLayout)">
            <p>Sorry, there's nothing at this address.</p>
        </LayoutView>
    </NotFound>
</Router>

_Host.cshtml

@page "/"
@namespace StampaManualeEtichetteAggiuntive.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="_content/Blazored.Modal/blazored-modal.css" rel="stylesheet" />
<title>StampaManualeEtichette</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
</head>
<body>
<app>
    <component type="typeof(App)" render-mode="ServerPrerendered" />
</app>

<div id="blazor-error-ui">
    <environment include="Staging,Production">
        An error has occurred. This application may no longer respond until reloaded.
    </environment>
    <environment include="Development">
        An unhandled exception has occurred. See browser dev tools for details.
    </environment>
    <a href="" class="reload">Reload</a>
    <a class="dismiss"></a>
</div>

<script src="_framework/blazor.server.js"></script>
<script src="_content/Blazored.Modal/blazored.modal.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font- 
awesome/5.15.1/css/all.min.css">
<script src="css/font-awesome/js/all.min.js"></script>
</body>
</html>

And in my Index.razor

[CascadingParameter] public IModalService Modal { get; set; }

Can some one help me solving the problem?

0

There are 0 answers