MVC中的多个.ashx处理程序 [英] Multiple .ashx handlers in MVC
问题描述
我一直在我的MVC项目中使用.ashx处理程序来基于用户ID渲染用户图像很长时间,现在我想使用另一个处理程序执行其他任务。为此,在我的项目的根目录中添加了一个新的.ashx处理程序。
但问题是,即使我试图调试应用程序或使用它,它只是打第一个处理程序..
例如
我有两个处理程序HandlerA.ashx& HandlerB.ashx
因此,即使在执行localhost / MyApp / HandlerA.asxh OR localhost / MyApp / HandlerB.asxh之后,我总是在HandlerA.ashx上获得命中>
有没有办法通过添加自定义路线或其他东西来使用多个处理程序。
等待指导。
干杯,
:)
我尝试了什么:
尝试了谷歌并点击并试用了一些代码块routeconfig.cs:)
问题是由于复制/粘贴疏忽,因为我通过复制第一个处理程序创建了第二个处理程序而错过了更改类名新创建的标记。
因为它正在击中同一个处理程序。 :(
I have been using a .ashx Handler in my MVC project to render user images based on userid for much time, and Now I want to perform some other task using another handler. For that purpose added a new .ashx handler in root of my project.
But the problem is when even i tried to debug the application or use it , It is hitting the first handler only..
e.g.
I have twohandlers HandlerA.ashx & HandlerB.ashx
So I always get the hit on HandlerA.ashx even after doing localhost/MyApp/HandlerA.asxh OR localhost/MyApp/HandlerB.asxh
Is there any way to use multiple handlers by adding custom routes or something else.
Waiting for the guidance.
Cheers,
:)
What I have tried:
Have tried google and hit and try on some code chunks in routeconfig.cs :)
The issue was due to copy/paste negligence as I created the second handler by copying the first one and missed to change the class name in the markup of newly created one.
And because of that It was hitting to the same handler. :(
这篇关于MVC中的多个.ashx处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!