Jquery Ajax responseetext "Request processing error"

I get this error . A request processing error has occurred in the UAT environment . In my local code, it seems to work fine.

This line is Utility.WriteLogEvent ("TestService", strMessage); writes directly to db. In any case, if this line fails or not, I can still get the message coming from the server, because it is correctly processed.

But since I do not receive any response from the server, this means that my web method is not available.

Given that the code below works, is there something I need to install in web.config to make this work? Or somewhere, can I start checking in IIS, which might give me some hints?

Thank.

$('#lnkTest').click(function () {
    alert('Click event is firing!');
    $.ajax({
        type: "POST",
        url: "/_layouts/ServiceForm.aspx/TestService",
        data: "{}",
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        success: function (response) {
            if (response.d && response.d.length > 0) {
                alert(response.d);
            }
        },
        error: function (xhr, err) {
            alert('responseText:' + xhr.responseText);
        }
    });
});

Here is my C # web method

[WebMethod]
public static string TestService()
{
    string strMessage = string.Empty;
    try
    {
        strMessage = "The service is running.";
        Utility.WriteLogEvent("TestService", strMessage);
    }
    catch (Exception ex)
    {
        strMessage = "TestService fail.";

    }
    return strMessage;
}
+4
source share
2 answers

I solved the problem. This is due to the fact that the dll was deployed on the application server and was blocked by the installed antivirus.

0
source

For others that may encounter the same error when calling WebMethod with parameters.

, , ​​ . . , if statement.

+3

All Articles