Reputation: 1
I have an issue that when loading page include a service, it has this exception:
InvalidOperationException: Cannot provide a value for property 'FileService' on type 'FutureVision.Portal.Client.Pages.FileManager'. There is no registered service of type 'FutureVision.Portal.Client.Services.IFileService'.
As I debug, the first time load the file-manager page, it not run into program.cs, and my service is not registered.
The file manager component needs @rendermode InteractiveWebAssembly to load the ui. How do I register my service at client site with the page using InteractiveWebAssembly?
Upvotes: 0
Views: 25
Reputation: 1
While the InteractiveWebAssembly render mode renders content on the client, prerendering occurs on the server. With this in mind, there are two things you can do to resolve the issue:
Register the service in both the Client and Server applications. Disable prerendering for either the entire application or for just this component.
Please refer to the following article for more details: Client-side services fail to resolve during prerendering
@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
Upvotes: 0