Closed akorchev closed 5 years ago
I think, I have the same error
.NET Core SDK version: 3.0.100-preview6-012264
OS Name: Window 10
OS Version: 1903
I have a project Blazor client. It is configured as a page in a project Asp.net Core MVC
app.Map("/cms", appBuilder =>
{
app.UseClientSideBlazorFiles<Admin.Startup>();
app.UseEndpoints(endpoints =>
{
endpoints.MapFallbackToClientSideBlazor<Admin.Startup>("index.html");
});
});
In index.html file
<base href="/cms/" />
/cms/css/site.css not found ...
It run without error in SDK version preview5
Thanks for contacting us, @akorchev. @javiercn can you please look into this? Thanks!
@huanbd Your issue is likely unrelated.
If you have a base path then you need to reference files relative to the root (starting with '/' or call app.UseStaticFiles()
within the app.Map("/cms", ...)
call before app.UseClientSideBlazorFiles
Hi @javiercn , I've used app.UseStaticFiles()
before that, this is my Configure
method in Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBlazorDebugging();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.Map("/cms", appBuilder =>
{
app.UseClientSideBlazorFiles<Admin.Startup>();
app.UseEndpoints(endpoints =>
{
endpoints.MapFallbackToClientSideBlazor<Admin.Startup>("index.html");
});
});
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
May I miss something about api change?
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBlazorDebugging();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.Map("/cms", appBuilder =>
{
// You either add this call or reference the file as /css/site.css as the physical path on disk for the file I imagine is /css/site.css
app.UseStaticFiles();
app.UseClientSideBlazorFiles<Admin.Startup>();
app.UseEndpoints(endpoints =>
{
endpoints.MapFallbackToClientSideBlazor<Admin.Startup>("index.html");
});
});
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
I did that but still error, and note that Client side Blazor is a project, that's outside of project MVC, and static files are in project client side Blazor and in version SDK preview 5 It run without error
@huanbd Your issue is unrelated to this issue. I believe it might have been related to an issue we fixed a couple of days ago. I would suggest you try out with the next preview release or file a separate issue and include a repro project.
@akorchev I'm not able to repro the issue with your project and the latest sdk. Could you provide what sdk you are using? We have automation covering the scenario you describe, so I'm inclined to think that the razor sdk in use might be old.
Could you please try with the latest sdk from https://github.com/dotnet/core-sdk and see if you still have this issue?
Closing for now as no-repro
@javiercn I think I am using the latest SDK:
.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview6-012264
Commit: be3f0c1a03
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.13-x64
Base Path: /usr/local/share/dotnet/sdk/3.0.100-preview6-012264/
Host (useful for support):
Version: 3.0.0-preview6-27804-01
Commit: fdf81c6faf
If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to secure@microsoft.com. Your report may be eligible for our bug bounty but ONLY if it is reported through email.
Describe the bug
The approach described here and here does not seem to work in server-side Blazor applications.
To Reproduce
Steps to reproduce the behavior:
dotnet new blazorserverside -o BlazorWebApp1
(a change from the preview 6 announcement blog post)dotnet new razorclasslib -o RazorLib1
dotnet add BlazorWebApp1 reference RazorLib1
RazorLib1/wwwroot/
e.g.styles.css
<link rel="stylesheet" href="_content/RazorLib1/styles.css">
to _Host.cshtmldotnet run
My test application is available here.
Expected behavior
I would expect for this to work as it seems to should have been a supported scenario.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context