如何处理从Asmx服务返回的错误500 [英] How to handle Error 500 coming back from asmx service
问题描述
我有一个不允许进行GET的标准asmx服务。
I have a standard asmx service on which GET is not allowed.
如果我访问asmx http:// mysite / myservice。浏览器(GET)中的asmx / myoperation
我得到了刷新到客户端的堆栈跟踪,并且从提琴手那里看到这是500个内部系统错误。我的代码都没有被命中。
If I visit the asmx http://mysite/myservice.asmx/myoperation
in the browser (GET) I get a stack trace flushed to the client and I can see from fiddler it's a 500 internal system error. None of my code is being hit.
我有一个要求,如果从浏览器访问了URL,则不显示堆栈跟踪,因此我想重定向到我有一个自定义的错误页面。
I have a requirement not to show a stack trace if the url is visited from the browser, so I'd like to redirect to a custom error page I have in place.
我在global.asax上有一个Application_Error,但在此特定实例中没有启动。
I have an Application_Error on the global.asax but its not kicking in in this particular instance.
感谢任何帮助!
推荐答案
如果通过
<configuration>
<system.web>
<webServices>
<protocols>
<remove name="HttpPost"/>
<remove name="HttpGet"/>
<remove name="Documentation"/>
</protocols>
</webServices>
</system.web>
</configuration>
这篇关于如何处理从Asmx服务返回的错误500的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!