Debugging not hit breakpoints in .NET CORE MVC 6 application

前端 未结 5 2684
猫巷女王i
猫巷女王i 2021-02-20 10:31

I am working on .NET CORE 1.0 MVC 6 application and I stuck with the debugging point as it stopping hitting yesterday. with number of try I delete project and start again. First

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-20 10:42

    I thought I was running into this same behavior except in my case it was caused by Temporal Coupling in the Startup.cs class of my .NET Core MVC application.

    I had included my app.UseMiddleware() call below my app.UseMvc() call and because of this my middleware component would initialize but was never hit by requests coming into my application. Moving my call to app.UseMiddleware call above the app.UseMvc call fixed this and now my requests are being properly routed through my custom middleware.

    app.UseMVC MUST BE THE LAST "app.Use()" call in the Configure method of your Startup.cs class

提交回复
热议问题