I've created a web service that other sites can use to store errors in my database. They can then come to my site to view their errors, search through errors, filter errors, etc. However, I'm getting the following error for my web service:
System.Web.HttpContext cannot be serialized because it does not have a parameterless constructor.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: System.Web.HttpContext cannot be serialized because it does not have a parameterless constructor.
The web service contains the following function:
[WebMethod] public static void LogError(HttpContext context, Exception exception, string APIKey) { //Log the error }
The external site that is using the web service to log exceptions contains the following code in the global.asax file:
void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs WebService.Errors.ErrorHandler.LogError(HttpContext.Current, Server.GetLastError(), "NOLDFHOI"); }
How can I get the HttpContext from their site into my function from the web service?