Handle exceptions in web services with Elmah

后端 未结 3 622
[愿得一人]
[愿得一人] 2020-12-09 08:05

Is there a way to globally handle exceptions in regular ASP.NET Web Service (asmx) using ELMAH like we do it in ASP.NET web site ?

3条回答
  •  星月不相逢
    2020-12-09 08:37

    You can use this code

     try{
    // your code in here
    }
         catch (Exception ert)
                {
                    Elmah.ErrorSignal.FromCurrentContext().Raise(ert);
    
                }
    

提交回复
热议问题