locked
ajax error {"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""} RRS feed

  • Question

  • User424885138 posted

    I calling a local asp.net web service via an jquery ajax call.  I'm getting an error, which in Fiddler comes back as {"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}.   I have several other web services similar to the one giving an error that work fine, the only difference between them is the one in question returns a string value.  I can run the web service from visual studio and it works fine.  I can run the stored procedure that's called in the web service and it works fine.  I thought it might have been a problem with the data syntax in the ajax call so I hard coded the value in web service.  I've changed the entity framework function import call to return both "none" and "string" without change. I did remember to uncomment the json call in the web service. At this point I'm at a loss.

    I would appreciate it if someone could look at the code and see if there are any glaring mistakes or offer some advise of what else to check.

    Thanks,
    Tom

    [System.Web.Script.Services.ScriptService]
    public class wsDeptServices : System.Web.Services.WebService {
        sfhsEntities ctx = new sfhsEntities();

        public wsDeptServices () {

            //Uncomment the following line if using designed components
            //InitializeComponent();
        }

        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]

        [WebMethod]
        public String GetApparatusStationLocaion(int ID)
        {
            using (sfhsEntities context = new sfhsEntities())
            {
                System.Data.Objects.ObjectParameter AoutputParameter = new System.Data.Objects.ObjectParameter("StationDesc", typeof(String));
                ctx.GetApparatusStationLocation(ID, AoutputParameter);
                return (String)AoutputParameter.Value;
            }
        }
        
    }

     var pageUrl = '<%=ResolveUrl("~/wsGetDefCount.asmx")%>'
                         $.ajax({
                             type: "POST",
                             url: pageUrl + "/GetApparatusTroubleTicketCountByID",
                             data: "{ 'ID': '" + $("#txtCurID").val() + "' }",
                             contentType: "application/json; charset=utf-8",
                             dataType: "json",
                             async: false,
                             success: function (msg) {
                                 //alert('In ' + msg.d);
                                 $("#txtTTID").val(msg.d);
                             },
                             error: OnError
                         });

    Friday, October 12, 2012 9:06 AM

All replies

  • User424885138 posted

    Sorry, but I copied  in the wrong ajax call.  The one I posted is one that works.  The one below is the problem.

      var pageUrl = '<%=ResolveUrl("~/wsDeptServices.asmx")%>'
                       $("#txtApparatusID").val(itemValue);
                       $.ajax({
                           type: "POST",
                           url: pageUrl + "/GetApparatusStationLocaion",
                           //data: "{ID:" + itemValue + "}",
                           data: { ID: 1 },
                          // data: "{ 'ID': '" + $("#txtApparatusID").val() + "' }",
                           contentType: "application/json; charset=utf-8",
                           dataType: "json",
                           async: false,
                           success: function (msg) {
                               alert(msg.d);
                               //$("#txtName").val(msg.d);
                           },
                           error: function () {
                               alert('error');
                           }

                       });

    Friday, October 12, 2012 9:13 AM
  • User-1559657530 posted

    Hi tcl4p, i know that this post is old but i'm getting this same error in my app.

    How do you solve this problem?

    Wednesday, August 21, 2013 3:03 PM
  • User-878546344 posted

    I realise that this post is old but thought I would share my experience with this error. I was calling a .NET web method from a jquery ajax function that removed images from the server for a gallery. All worked fine in local dev but when put live I got the error {"Message":"There was an error processing the request.","StackTrace":"","Exception...etc - no information about the error, couldnt log it in the back end to get more detail as the ajax call would error without hitting the web method. 

    I turned out to be as simple as folder permissions, the IIS user didnt have permission to modify/delete files in the folder. Hours wasted trying to fix something unbeleivably simple because of no error information.

    Monday, February 17, 2014 4:18 AM