3

I know that this is a question often asked in here, I have tried all the answers, and none of them work. When I consume the webservices I get no error message, and it works ok. But I do get this error 10-20 times each day. So someone do get this error, but I cant reproduce it.

Here is the error stack trace. Any help?

Exception stack trace: 
   at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
   at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath)
   at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
   at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
   at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

This is how I call the web service:

$.ajax({
    type: 'POST',
    contentType: 'application/json; charset=utf-8',
    url: 'MyWebService.asmx/MyWebService',
    data: '{"id":"' + id+ '"}',
    dataType: 'json',
    success:
        function(msg) {
            // Do something
        },
    error:
        function(XMLHttpRequest, textStatus, errorThrown) {
            // Do something
        }
});

This is my very simple web service:

    [WebMethod(EnableSession = true)]
    public string MyWebService(int id)
    {
       return "Something";
    }

UPDATE:

I see in my logs that the user agent always is Google translate when this error appear.

http://translate.googleusercontent.com/translate_c?hl=es&prev=/search?q=test&hl=es&client=safari&tbo=d&rurl=translate.google.es&sl=en&u=http://www.mydomain.com&usg=ALkJrhhcOM9LJgtG-RhFx1XSQw-g4h_tbQ

You know how I can stop this?

Martin at Mennt
  • 5,677
  • 13
  • 61
  • 89

1 Answers1

0

Considering that the error only occurs when google translate requests your service could it be possible that google translate does not issue a POST request but a GET request to your service method? In case google translate uses a GET request your solution may be here to stop the issue.

Community
  • 1
  • 1
saintedlama
  • 6,838
  • 1
  • 28
  • 46