❔ ASP.NET Core Middleware running only once
Hello!
I have a custom middleware that runs only once and isn't running on every request.
When I put breakpoint into my pipeline or into my custom middleware it won't break or run.
Any ideas why?
8 Replies
Requests aren't reaching controllers as well, right?
Requests are reaching controllers
It's just that the pipeline breaks me only once - at the start of the app.
It doesn't break me when request is happening - for example I have dependency injection for CurUserCookie it doesnt run before it reaches the Controller - hmaking my CurUser null.
Okay so reaching controllers means the middleware is getting executed, where are your breakpoints set?
Or even if I set them anywhre in my pipeline they will break only after starting the app first time.
Have you tried adding any logging statements inside the middleware?
I'm not really sure why the breakpoint isn't getting hit
Restarting VS fixed the issue for some reason (Even though I restarted before). Weird, but thanks 🙂
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.