BlazorWasmPreRendering.Build: Error when publishing to GitHub pages
Here are my messages on publish from GitHub repo:
Start fetching...[http://127.0.0.1:5050/]
[18](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:18)
Getting http://127.0.0.1:5050/...
[19](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:19)
Error: ROR] The HTTP status code was not OK. (it was (500)InternalServerError.)
[20](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:20)
System.InvalidOperationException: Cannot provide a value for property 'Analytics' on type 'Blazor.Analytics.Components.NavigationTracker'. There is no registered service of type 'Blazor.Analytics.IAnalytics'.
[21](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:21)
at Microsoft.AspNetCore.Components.ComponentFactory.<>c__DisplayClass7_0.<CreateInitializer>g__Initialize|1(IServiceProvider serviceProvider, IComponent component)
[22](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:22)
at Microsoft.AspNetCore.Components.ComponentFactory.PerformPropertyInjection(IServiceProvider serviceProvider, IComponent instance)
[23](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:23)
at Microsoft.AspNetCore.Components.ComponentFactory.InstantiateComponent(IServiceProvider serviceProvider, Type componentType)
[24](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:24)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.InstantiateChildComponentOnFrame(RenderTreeFrame& frame, Int32 parentComponentId)
[25](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:25)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(DiffContext& diffContext, Int32 frameIndex)
[26](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:26)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(DiffContext& diffContext, Int32 frameIndex)
[27](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:27)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex)
[28](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:28)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)
[29](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:29)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange`1 oldTree, ArrayRange`1 newTree)
[30](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:30)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
[31](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:31)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
[32](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:32)
--- End of stack trace from previous location ---
[33](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:33)
at Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.HandleException(Exception exception)
[34](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:34)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
[35](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:35)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessPendingRender()
[36](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:36)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.AddToRenderQueue(Int32 componentId, RenderFragment renderFragment)
[37](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:37)
at Microsoft.AspNetCore.Components.ComponentBase.StateHasChanged()
[38](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:38)
at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync()
[39](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:39)
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
[40](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:40)
at Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.HandleException(Exception exception)
[41](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:41)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.HandleExceptionViaErrorBoundary(Exception error, ComponentState errorSourceOrNull)
[42](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:42)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.AddToPendingTasks(Task task, ComponentState owningComponentState)
[43](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:43)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(ParameterView directAndCascadingParameters)
[44](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:44)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.SetDirectParameters(ParameterView parameters)
[45](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:45)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderRootComponentAsync(Int32 componentId, ParameterView initialParameters)
[46](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:46)
at Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.CreateInitialRenderAsync(Type componentType, ParameterView initialParameters)
[47](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:47)
at Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.RenderComponentAsync(Type componentType, ParameterView initialParameters)
[48](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:48)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c__11`1.<<InvokeAsync>b__11_0>d.MoveNext()
[49](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:49)
--- End of stack trace from previous location ---
[50](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:50)
at Microsoft.AspNetCore.Mvc.ViewFeatures.StaticComponentRenderer.PrerenderComponentAsync(ParameterView parameters, HttpContext httpContext, Type componentType)
[51](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:51)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ComponentRenderer.StaticComponentAsync(HttpContext context, Type type, ParameterView parametersCollection)
[52](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:52)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ComponentRenderer.RenderComponentAsync(ViewContext viewContext, Type componentType, RenderMode renderMode, Object parameters)
[53](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:53)
at AspNetCoreGeneratedDocument.Pages__Host.ExecuteAsync() in C:\Projects\Blazor\BlazorWasmPreRendering.Build\BlazorWasmPreRendering.Build\Pages\_Host.cshtml:line 5
[54](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:54)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
[55](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:55)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
[56](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:56)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
[57](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:57)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
[58](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:58)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
[59](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:59)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
[60](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:60)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
[61](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:61)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
[62](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:62)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
[63](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:63)
--- End of stack trace from previous location ---
[64](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:64)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
[65](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:65)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
[66](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:66)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
[67](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:67)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
[68](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:68)
--- End of stack trace from previous location ---
[69](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:69)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
[70](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:70)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
[71](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:71)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
[72](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:72)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
[73](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:73)
[74](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:74)
HEADERS
[75](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:75)
=======
[76](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:76)
Host: 127.0.0.1:5050
[77](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:77)
[78](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:78)
[79](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:79)
INFORMATION
[80](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:80)
===========
[81](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:81)
The crawler encountered errors and/or warnings.
[82](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:82)
If you want to keep running the pre-rendering server process for debugging it on live, you can do that by setting the "BlazorWasmPrerenderingKeepServer" MSBuild property to "true".
[83](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:83)
[84](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:84)
ex) dotnet publish -p:BlazorWasmPrerenderingKeepServer=true
[85](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:85)
[86](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:86)
Fetching complete.
[87](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:87)
/home/runner/.nuget/packages/blazorwasmprerendering.build/1.0.0-preview.23.0/build/BlazorWasmPreRendering.Build.targets(56,5): error MSB3073: The command "dotnet "/home/runner/.nuget/packages/blazorwasmprerendering.build/1.0.0-preview.23.0/build/../tools/net6.0/blazorwasm-prerendering-server.dll" -a "angelblaze" -t "angelblaze.App" --selectorofrootcomponent "#app,app" --selectorofheadoutletcomponent "head::after" -p "/home/runner/work/angelblaze/angelblaze/bin/Release/net6.0/publish" -i "/home/runner/work/angelblaze/angelblaze/obj/Release/net6.0/." -m "" -f "net6.0" --serviceworkerassetsmanifest "" -e "Prerendering" -o "AppendHtmlExtension" -u "" -r "Static"" exited with code 1. [/home/runner/work/angelblaze/angelblaze/angelblaze.csproj]
[88](https://github.com/nakigoe/angelblaze/runs/5672208861?check_suite_focus=true#step:4:88)
Error: Process completed with exit code 1.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 15 (9 by maintainers)
@nakigoe I split this issue to #31 to be easy to handle and save me from confusion.
HTML that is generated has errors according to https://validator.w3.org/nu/
Trailing slash on void elements has no effect and interacts badly with unquoted attribute values.
The automatically generated trailing slash inside HTML tags prevents images from displaying when sharing the website on social networks (LinkedIn)Your English is great、英語はも大丈夫でいらっしゃるのです。
@nakigoe
If you mean the “app” is this “BlazorWasmPreRendering.Build” package, the answer might be “Yes”, but it depends on what you expect.
Please understand the working principle of the
BlazorWasmPreRendering.Build
package. TheBlazorWasmPreRendering.Build
package just makes your Blazor WebAssembly app run as a Blazor Server app with some tricks. Therefore, there is no difference in the pre-rendering process with the usual Blazor Server pre-rendering. It might be hard to understand if you are unfamiliar with the server-side pre-rendering on Blazor Server apps, but TheBlazorWasmPreRendering.Build
package isn’t doing something special over the usual Blazor Server apps doing.From that perspective, the
BlazorWasmPreRendering.Build
package supports all features as usual Blazor Server apps with server-side pre-rendering, such as Cookies, Globalization, and Localization. (However, the Cookie support doesn’t make sense during the pre-rendering process because the pre-rendering process doesn’t involve any HTTP request. Cookies are always empty during the pre-rendering process.)日本語
「アプリ」がこの「BlazorWasmPreRendering.Build」パッケージであるということであれば、答えは「はい」かもしれませんが、それはあなたが何を期待しているかによって異なります。
BlazorWasmPreRendering.Build
パッケージの動作原理を理解してください。BlazorWasmPreRendering.Build
パッケージは、いくつかのトリックを使用して Blazor WebAssembly アプリを Blazor Server アプリとして実行するだけです。 したがって、プリレンダリング プロセスには、通常の Blazor Server のプリレンダリングと違いはありません。 Blazor Server アプリでのサーバー側のプリレンダリングに慣れていない場合は、理解するのが難しいかもしれませんが、BlazorWasmPreRendering.Build
パッケージはそれ以上の特別なことをしているわけではありません。その観点から、
BlazorWasmPreRendering.Build
パッケージは、サーバー側の事前レンダリングを備えた通常の Blazor サーバー アプリと同様に、Cookie、グローバリゼーション、ローカリゼーションなどのすべての機能をサポートします。 (ただし、プリレンダリング プロセスには HTTP リクエストが含まれないため、プリレンダリング プロセス中は Cookie サポートは意味を持ちません。プリレンダリング プロセス中、Cookie は常に空です。)@nakigoe
This error will happen if you use the JavaScript interop feature of Blazor in the
OnInitializedAsync
life cycle. You can only call JavaScript code afterOnAfterRenderAsync
is invoked. That is a limitation of theBlazorWasmPreRendering.Build
package.See also: https://docs.microsoft.com/aspnet/core/blazor/javascript-interoperability/call-javascript-from-dotnet#prerendering
Please understand that the pre-rendering process runs outside the web browser, inside any PC locally, like a usual console app. Therefore, there is no JavaScript engine during the publishing process. This is the reason for the limitation that the JavaScript interop can not use in the
OnInitializedAsync
life cycle on pre-rendering.日本語
このエラーは、「OnInitializedAsync」ライフ サイクルで Blazor の JavaScript 相互運用機能を使用する場合に発生します。 JavaScript コードは、「OnAfterRenderAsync」が呼び出された後にのみ呼び出すことができます。 これは、
BlazorWasmPreRendering.Build
パッケージの制限です。参照: https://docs.microsoft.com/aspnet/core/blazor/javascript-interoperability/call-javascript-from-dotnet#prerendering
プリレンダリング プロセスは、通常のコンソール アプリと同様に、Web ブラウザーの外部、ローカルの PC 内で実行されることを理解してください。 したがって、公開プロセス中に JavaScript エンジンは存在しません。 これが、プリレンダリング時の
OnInitializedAsync
ライフサイクルで JavaScript 相互運用機能が使用できない制限の理由です。@jsakamoto 様 いつもお世話になっております。 Nakigoeです、凄く感謝いたします。
What I loved about Your project, is that the
index.html
files that are generated are claimed to be hidden from the user. Are they?The NuGet is working for the basic project, but
the initial loading time with VPN enabled seems to be slower with this NuGet, it stucks for a long time on 95% and then after about 5 seconds more finally loads. That’s odd for the basic template. Any recommendations? The initial loading is unacceptably slow when the VPN connection is enabled. I know that’s the way Blazor WebAssembly operates, but is there a smart workaround?
日本語が話せますけれど、Could You please utilize
the LanguageTool
orGrammarly
or an alternative to correct your English to have clearer instructions in all of your articlesMy code for a basic template: https://github.com/nakigoe/blazorwasm
The website that is generated: https://blazorwasm.nakigoe.org/
Does Your app work with Cookies, Globalization, and Localization? (the standard, a bit simplified Microsoft Globalization and Localization via the .resx files) I do have a serious Blazor WebAssembly website for Your NuGet: https://nakigoe.org Might I have your email to send the
program.cs
Please cast an eye on my website:
@nakigoe Refer Program.cs of ilovedotnet. I use use the Blazor.Analytics package in my project and it works fine. If you still face an issue please share your
Program.cs
or feel free to close this if your issue is resolved as this is in open sate for long time awaiting your response.@nakigoe
I guessed your
Program.cs
maybe like below:If that is true, you must rewrite your
Program.cs
to be like the below:Could you try that out?
Or, if my guessing is false, please disclose your
Program.cs
code to me to reproduce and investigate this problem.