Javascript.NodeJS icon indicating copy to clipboard operation
Javascript.NodeJS copied to clipboard

Suitable constructor for Jering.Javascript.NodeJS.HttpClientService Exception

Open NiftyImages opened this issue 1 year ago • 2 comments

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 avatar Oct 03 '23 19:10 NiftyImages

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<INodeJSService>(); var t = await nodeJSService.InvokeFromStringAsync(javascript); //

And:

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

NiftyImages avatar Oct 03 '23 21:10 NiftyImages

Hi, what package version are you using?

JeremyTCD avatar Oct 04 '23 15:10 JeremyTCD