I have a small problem with an ignored exception event in my web service.
This is my Global.asax.cs file:
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
namespace AcmeDemoApp
{
public class Global : System.Web.HttpApplication
{
private static Logger logger = LogManager.GetCurrentClassLogger();
protected void Application_Start(object sender, EventArgs e)
{
logger.Debug("Application_Start");
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
}
protected void Session_Start(object sender, EventArgs e)
{
logger.Debug("Session_Start");
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
logger.Debug("Application_BeginRequest");
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
logger.Debug("Application_AuthenticateRequest");
}
protected void Application_Error(object sender, EventArgs e)
{
logger.Debug("Application_Error");
}
protected void Session_End(object sender, EventArgs e)
{
logger.Debug("Session_End");
}
protected void Application_End(object sender, EventArgs e)
{
logger.Debug("Application_End");
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
logger.Debug("CurrentDomain_UnhandledException");
}
}
}
And after I execute a request. I get this error from the web service.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Receiver</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ArgumentException: Error
--- End of inner exception stack trace ---</soap:Text>
</soap:Reason>
<soap:Detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
And in the log file of NLog I see only:
[2016-05-01 02:11:25.3629] [Info] Application_BeginRequest
[2016-05-01 02:11:27.3861] [Info] Application_AuthenticateRequest
Why is the UnhandledException ignored?
Is there another event or method I must use to get all soap
errors, too?
Or can you give me a hint how to fix this problem?
Thank you in Advance for any idea!