I have a C# ASP.NET website with various WebMethods. This website has no user authentication. The WebMethods look something like this on the server side:
[WebMethod]
public static string GetInfo() { ... }
I am using the JavaScript PageMethods (built in with Visual Studio's web project template; I think it uses AJAX?) to call these WebMethods from JavaScript, like this:
PageMethods.GetInfo(callbackOnSuccess, callbackOnFailure);
Some of these WebMethods are called in the background every 30 seconds. However, sometimes the WebMethod will be called just fine multiple times, and then the exact same method with the same args will return the following error:
{"_timedOut":false,"_message":"There was an error processing the request.",
"_stackTrace":"","_exceptionType":"","_errorObject":{"Message":"There was an
error processing the request.","StackTrace":"","ExceptionType":""},"_statusCode":401}
I know that a 401 error means Unauthorized. But 1) my app doesn't use any authorization, and 2) why would it work over and over again, then fail in the same session, then go back to working again? Both the client and the server run the exact same function over time; they don't change throughout the session. This issue is not easily reproducible; it seems to happen at random times, so it's hard to tell if any changes I make fix it until it randomly happens again in a day or two.
I suspect the issue is server side because it seems like the issue happens to different users (on different devices) at the same time. What might be my problem?
Note: My server WebMethods have a reliable try-catch around them so they can still return a clean response in the case of an unexpected error. But I don't think the client's call is ever making it to the server because I'm not getting that clean response on the client side. Hopefully that helps.