JeringTech / Javascript.NodeJS

Invoke Javascript in NodeJS, from C#
Other
454 stars 43 forks source link

Suitable constructor for Jering.Javascript.NodeJS.HttpClientService Exception #180

Open NiftyImages opened 11 months ago

NiftyImages commented 11 months ago

First let me say Thank You. I got your library to work on a console project to test the functionality and it worked as expected (even better).

I'm now creating an asp.net app .NET Framework 4.7 and I'm receiving the following error:

A suitable constructor for type 'Jering.Javascript.NodeJS.HttpClientService' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.

If anyone could help or point me in the right direction I would greatly appreciate it.

NiftyImages commented 11 months ago

For more context, I've tried both the StaticNodeJSService and DependencyInjection.

// var services = new ServiceCollection(); services.AddNodeJS(); ServiceProvider serviceProvider = services.BuildServiceProvider(); INodeJSService nodeJSService = serviceProvider.GetRequiredService(); var t = await nodeJSService.InvokeFromStringAsync(javascript); //

And:

// var t = await StaticNodeJSService.InvokeFromStringAsync(javascript); //

JeremyTCD commented 11 months ago

Hi, what package version are you using?