Closed ionican closed 2 years ago
You must load System.Net.Http
. See https://github.com/Tewr/BlazorWorker#setup-dependencies . For this specific dependency, you can use the helper method .AddHttpClient()
. For any other similar errors, use the methods AddAssemblies
or AddAssemblyOf<>
. See the demo project for more examples.
Right thank you - in the end I needed to add a number of assemblies: var service = await worker.CreateBackgroundServiceAsync<DataLoader>( options => options .AddAssemblies("IMS36.dll", "IMS36.Shared.dll","System.Net.Http.dll","System.Net.Primitives.dll", "System.Security.Cryptography.X509Certificates.dll", "System.Diagnostics.Tracing.dll", "Microsoft.Extensions.DependencyInjection.dll") );
and I see you allude to several of them in the demo example. I'm getting a crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Sequence contains no matching element
error now but I think this is probably due to an understanding deficit on my side in respect of the messaging. I'll continue to study the examples.
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Sequence contains no matching element
seems unrelated and very blazor-related. try to isolate the call to the service and the results you get from the rendering of it.
I'm closing this. Feel free to open a new issue if you have other questions.
I'm getting the following error when trying to instantiate the worker service:
var service = await worker.CreateBackgroundServiceAsync<StateDataManager>();
This is immediately followed by:
The data import works fine when run conventionally 'in-line'. Not sure if this is a BlazorWorker issue or I'm doing something untoward with it.