Skip to content

Bug:Should clean the context.Items cache #232

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

Closed
mangshao opened this issue Jan 8, 2018 · 5 comments
Closed

Bug:Should clean the context.Items cache #232

mangshao opened this issue Jan 8, 2018 · 5 comments

Comments

@mangshao
Copy link

mangshao commented Jan 8, 2018

@commonsensesoftware
Copy link
Collaborator

The properties stored in HttpContext.Items is not a cache. They only store information about the current request. Per the documentation, the "collection is available from the start of an HttpRequest and is discarded at the end of each request".

I'm not sure what the issue or expected action is here.

@mangshao
Copy link
Author

You can check this blog

@commonsensesoftware
Copy link
Collaborator

Unfortunately, I don't know what language that is nor what it says.

From what I can discern, it appears that you're encountering an issue with using the error page in conjunction with API versioning. Unfortunately, this is currently by design and is a limitation in how end of route middleware work. Both API versioning and the exception handler try to put themselves at the end of MVC pipeline. I've engaged with the ASP.NET team, but there needs to be some enhancements to the routing infrastructure in order to improve the experience.

I'm not entirely sure why a service would want an error page, but this is a topic that has come up a few times recently. I suggest taking a look at #221. I provided a workable solution that should help.

@commonsensesoftware
Copy link
Collaborator

I was able to use a translator on your blog post. I suggest you follow the thread and guidance in #221. That will get you the desired result without changing the IApiVersionRoutingPolicy. This issue is not related to items in the HttpContext. I can provide lengthy explanation if you like.

@commonsensesoftware
Copy link
Collaborator

Any further chance of this particular issue being a problem has been resolved by #280, which refactors to use a feature instead. There's a reasonable chance this was also related, at least in part, to #306. These changes have been realized in the 3.0 release. Thanks for the feedback.

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

No branches or pull requests

2 participants