I'm in the process of creating a basic .NET Core 2.0 App
[New]-[Project]-[.NET Core]->[ASP.NET Core Web Application (.NET Core)]-[Web Application (No Auth)]
and trying to add ReactJS by following the tutorial here: (https://reactjs.net/getting-started/tutorial.html)
When going through the tutorial, however, I get an "InvalidOperationException" error that says: 'Cannot resolve scoped service 'React.AspNet.HttpContextLifetimeProvider+PerRequestRegistrations' from root provider.'
Specifically the error comes from the app.UseReact(config=> ... ) section of the tutorial.
Despite my many searches both here and abroad I've come empty-handed, so I reach out to you all here. If this is referenced or already resolved here, please let me know as well.
I'm hoping I'm just overlooking something here.
Assumptions:
Update:
It turns out the problem was that there was a mismatch between the version of React that I had previously installed, and the Visual Studio Project's stated React version.
The solution was a simple reinstall of React via the command line to align with the project.
Thanks for all the help!
see https://github.com/reactjs/React.NET/issues/433
change in Startup.cs
public void ConfigureServices(IServiceCollection services)
to
public IServiceProvider ConfigureServices(IServiceCollection services)
and return services.BuildServiceProvider();
I also had to update/upgrade my node to c6.11.2 (via MSI), but I dont think thats related to your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With