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

middleware must be in execution pipeline before UseRouting to 'Configure(...)' in the application startup code. #14829

Closed
MikeAlhayek opened this issue Dec 4, 2023 · 2 comments · Fixed by #14830
Labels
Milestone

Comments

@MikeAlhayek
Copy link
Member

MikeAlhayek commented Dec 4, 2023

@jtkech maybe this issue due to #14801

But, when I run my app now I get this error

middleware must be in execution pipeline before UseRouting to 'Configure(...)' in the application startup code.

image

I am using IStartupFilter

services.AddSingleton<IStartupFilter, DetectionStartupFilter>();
public class DetectionStartupFilter : IStartupFilter
{
    public Action<IApplicationBuilder> Configure(Action<IApplicationBuilder> next)
    {
        return app =>
        {
            app.UseDetection();

            next(app);
        };
    }
}

The error is thrown here https://github.com/wangkanai/wangkanai/blob/2abff4ffcaf15a024b2c0705c941fb9353f2205d/Hosting/src/DependencyInjection/ApplicationBuilderExtensions.cs#L36

@MikeAlhayek
Copy link
Member Author

@jtkech I think configure(builder); should be called before await ConfigurePipelineAsync(builder); for this to work.

await ConfigurePipelineAsync(builder);
configure(builder);

@jtkech
Copy link
Member

jtkech commented Dec 4, 2023

Yes, my bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants