Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Injected IRestServer is not the running server #53

Closed
scottoffen opened this issue Mar 16, 2021 · 0 comments
Closed

Injected IRestServer is not the running server #53

scottoffen opened this issue Mar 16, 2021 · 0 comments
Labels
fixed Issue was fixed or otherwise resolved.

Comments

@scottoffen
Copy link
Owner

scottoffen commented Mar 16, 2021

Found in 5.0.0-rc.7

The sample project route http://localhost:1234/api/stop fails to stop the running server because the instance is being pulled from a different service provider than the one used to generate the running server (ergo, different instance).

The following fix will be in the RestServerBuilder.Build() method of the next version:

  // Override with instances
  Services.AddSingleton<IRestServer>(server);
  Services.AddSingleton<IRouter>(server.Router);
  Services.AddSingleton<IRouteScanner>(server.RouteScanner);

This will override the previous service registration of the interface to a concretion with a registration to an instance.

@scottoffen scottoffen added the fixed Issue was fixed or otherwise resolved. label Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Issue was fixed or otherwise resolved.
Projects
None yet
Development

No branches or pull requests

1 participant