StaticFiles assets not found in ASP.NET Core MVC With RCL

Viewed 34

I wat work with ASP.NET Core MVC and Razor Class Library (RCL). and created assets in wwwroot RCL then i want access files in Mvc project but not found.

I was followed this link https://docs.microsoft.com/en-us/aspnet/core/razor-pages/ui-class?view=aspnetcore-3.0&tabs=visual-studio#create-an-rcl-with-static-assets

My projects

Todo.App -> Mvc project
Todo.Shared -> RCL project

RCL wwwroot image

Add reference Todo.App project

 <ItemGroup>
    <ProjectReference Include="..\Todo.Shared\Todo.Shared.csproj" />
  </ItemGroup> 

Todo.App Project

Home/Index.cshtml

Add css link <link href="_content/Todo.Shared/css/site.css" rel="stylesheet" asp-append-version="true"

Default route: / Result: File found work successfully

Change route: /Home/Index Result: Failed to load resource: the server responded with a status of 404 ()

Consolation

When I run application default route pattern Home/Index and ignored routed redirect to /.
I mean when default route / not problem and found but any routes not found files.

/ -> Work, found files
/Home/Index -> Not found files
/Home/Dashboard ->  not found files 
/Home/Account -> not found files 
etc....

.NET Version

.NET 6

0 Answers
Related