-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blazor Server Project with Blazor running in different path #12
Comments
That trouble you reported may not be a matter of this SpeechSynthesis library. If you want to place your Blazor App to a sub-path (not root path), please follow the official document below. As the document above says, you don't have to change calling the For your reference, I'll attach a Blazor Server .NET6.0 sample app project that will work on the URL The zip file I attached above includes the Git repository, so you can see the commit history and diff to place the app on the sub-path. |
Hello and thank you for the response! With my use case, the Blazor app is in a folder within an existing MVC project (a single project) as I currently need my Blazor app to work this way. Correct, I don't think that there is an issue with the SpeechSynthesis library. I believe the issue in my use case is the SpeechSynthesis library is putting the js at https://localhost:44368/_content/... and looking at this location. With how I need to configure my project, when this library is integrated, it is looking at https://localhost:44368/**blazor**/_content/..., but that is not where the js is. It would be great to be able to configure SpeechSynthesis to put the js at https://localhost:44368/**blazor**/_content/. I apologize as I should have added more detail around my use case. |
@neo302 I'll keep investigating this scenario for you, but please understand this is a general problem on Blazor application programming. And it might take much longer than you expected because I'm currently so busy caring for other issues with my products. It might be better to ask about this problem on other online forums such as StackOverflow.com, Reddit, etc. P.S. |
Hi @neo302, I've tried to reproduce your case and resolve it. As I already said, it is hard that change the location of static contents bundled with Razor class libraries or NuGet packages from the URL "/_content/..." to the other URL due to the design of the Static Web Assets feature in the "ASP.NET Core". Instead, we can rewrite the request URL to the other URL where the requested static files exist exactly by using that "ASP.NET Core URL Rewrite middleware". For example, we can rewrite the request URL "/blazor/_content/foo/bar.js" to "/_content/foo/bar.js" in the early stage of the request processing pipeline, then the ASP.NET Core server will be able to respond to the contents of "bar.js" against to the request "/blazor/_content/foo/bar.js" from a web browser. Please see also the real example project I attached to this post below. I hope that the example project and this information be helpful for you. |
@jsakamoto Sorry for the delay. Thank you for taking time to look at this and for providing this solution! I think this is probably a nice approach to handling it and should work well. Thank you! |
Hello and thank you for the project!
I have a project running with blazor in separate path - https://localhost:44368/blazor/
Therefore I have:
Startup.cs
endpoints.MapBlazorHub("/Blazor/_blazor");
endpoints.MapFallbackToPage("~/Blazor/{*clientroutes:nonfile}", "/Blazor/_Host");
Pages/Blazor/_Host.cshtml
@page "/blazor"
...
<head>
...
<link rel="stylesheet" href="/css/site.css" />
<base href="~/blazor/" />
</head>
<body>
...
<script src="~/_framework/blazor.server.js"></script>
</body>
All of my other Blazor content works fine.
When attempting to use this project, I receive the error:
{"Failed to fetch dynamically imported module: https://localhost:44368/blazor/_content/Toolbelt.Blazor.SpeechSynthesis/script.module.min.js?v=10.0.0\nTypeError:
Failed to fetch dynamically imported module: https://localhost:44368/blazor/_content/Toolbelt.Blazor.SpeechSynthesis/script.module.min.js?v=10.0.0"}
Do you know how I can get this issue resolved?
Thank you!
The text was updated successfully, but these errors were encountered: