Skip to content

builder.Services.AddMvc().AddControllersAsServices(); can not work #126

Closed Answered by mythz
1257960069 asked this question in Q&A
Discussion options

You must be logged in to vote

You can resolve this by manually registering the dependency:

services.AddSingleton<ServiceStack.Host.ServiceController>(c => HostContext.ServiceController);
services.AddMvc(options => options.EnableEndpointRouting = false).AddControllersAsServices();

We'll pre-register it in the next version.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@1257960069
Comment options

Comment options

You must be logged in to vote
1 reply
@1257960069
Comment options

Answer selected by 1257960069
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants