How to handle Error 500 coming back from asmx service

送分小仙女□ 提交于 2019-12-25 00:37:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!