-
Notifications
You must be signed in to change notification settings - Fork 923
Closed
Labels
Description
I'm able to generate the HTML from a react component with the following code when processing an Http request. However the initialization blows up when ran elsewhere. Is it possible to render a component to html without an HTTPContext?
var environment = ReactEnvironment.Current; var reactComponent = environment.CreateComponent(component, props); var html = reactComponent.RenderHtml(renderServerOnly: true);
System.NullReferenceException: Object reference not set to an instance of an object.
at React.AspNet.HttpContextLifetimeProvider.get_Registrations()
at React.AspNet.HttpContextLifetimeProvider.GetObject()
at React.TinyIoC.TinyIoCContainer.CustomObjectLifetimeFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options)
at React.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options)