问题
I have a standard asmx service on which GET is not allowed.
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.
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.
I have an Application_Error on the global.asax but its not kicking in in this particular instance.
Any help appreciated!
回答1:
What happens if you disable GET requests via
<configuration>
<system.web>
<webServices>
<protocols>
<remove name="HttpPost"/>
<remove name="HttpGet"/>
<remove name="Documentation"/>
</protocols>
</webServices>
</system.web>
</configuration>
来源:https://stackoverflow.com/questions/4646123/how-to-handle-error-500-coming-back-from-asmx-service