English 中文(简体)
WCF服务失误
原标题:WCF service error when called from jQuery
  • 时间:2012-04-10 17:54:34
  •  标签:
  • jquery
  • wcf

I get a 500 error when trying to call the following service with the jquery code below, can anyone help please?

result.status = 500 result.statusText = "System.ServiceModel.ServiceActivationException"

这里是特别学校的服务:

    [WebInvoke( Method = "POST", 
                UriTemplate = "/tools/data/SearchAll")]
    public JsonArray SearchAll(string tool, JsonObject filters)
    {...}

The jQuery service calls:

    //Generic function to call WCF  Service
    function callService() {
        $.ajax({
            type: type, //GET or POST or PUT or DELETE verb
            url: url, // Location of the service
            data: data, //Data sent to server
            contentType: contentType, // content type sent to server
            dataType: dataType, //Expected data format from server
            processdata: processData, //True or False
            success: function (msg) {//On Successfull service call
                serviceSucceeded(msg);
            },
            error: serviceFailed// When Service call fails
        });
    }



    function searchAll() {
        var tool = "1";
        var filters =  {{ "col": "thiscol", "val": "thisval" }, { "col": "thiscol2", "val": "thisval2" }, { "col": "thiscol3", "val": "thisval3"}} ;
        type = "POST";
        url = "ToolService.svc/tools/data/SearchAll";
        contentType = "application/json; charset=utf-8";
        dataType = "json";
        data =  { "tool": "  + tool +  ", "filters" : "  + filters +  " } ,
        processData = false;
        method = "SearchAll";
        callService();
    }
问题回答

我这样说,它被证明是(除了其他事情外)正式组建的 j子被传到服务方法上,现在所有的 look子都好。

得到帮助。





相关问题
WCF DataMember Serializing questions

Ok, so I was part way through the long winded process of creating DTOs for sending my model over the wire and I don t feel like I m going down the right route. My issue is that most of the entities ...

Access WCF service on same server

I have a .NET website with a WCF service. How do I access the current operations context of my service? One possible work around is to just make a call to the service within the app...but that seems ...

WCF binding error

So I got into work early today and got the latest from source control. When I try to launch our ASP.NET application, I get this exception: "The binding at system.serviceModel/bindings/wsHttpBinding ...

The service operation requires a transaction to be flowed

I am facing strange issue with our WCF service. The same code was working fine until recently we added more OperationContracts(Web Methods). We have common 3 tier architecture. DAL (WCF) BLL Web ...

热门标签