WCF服务,使用的参数下载文件时,发送的GET请求数据

问题描述:

jQuery有用于与 GET 请求发送数据的支持:

jQuery has support for sending data with a GET request:

jQuery.get( url [, data ] [, success(data, textStatus, jqXHR) ] [, dataType ] )

是否有可能编写支持接收数据上的 GET 要求?WCF服务

这是例子太多AP preciated。

An example is much appreciated.

更新:URL长度超过了限额IE8和IE8是一个要求。我需要通过大量的参数,基本上是一个大的JSON。我所做的,以解决此就是让 POST 要求,参数存储在服务器端,然后设置 window.location的的服务位置调用 GET 的要求,将下载我的file.But,我想避免的 POST 要求,并存储在服务器端的文件,因为我是在分布式系统中,我有很多的问题与此有关。

UPDATE: Url length exceeds the limit for IE8 and IE8 is a requirement. I need to pass a lot of parameters, basically a big JSON. What I did to workaround this is to make a POST request,store the parameters on the server side, then set window.location to the service location the invoke a GET request that will download my file.But, I want to avoid the POST request and storing the file on server side because I'm in a distributed system and I have a lot of issues with this.

当然,您可以:

[OperationContract]
[WebInvoke(
    Method = "GET",
    UriTemplate = "SomeUrl?param1={param1}&param2={param2}"
)]
string SomeOperation(string param1, string param2);

然后:

$.get('SomeService.svc/SomeUrl?param1=SomeValue&param2=AnotherValue', function(response) {
    console.log(response);
});

或者

$.get('SomeService.svc/SomeUrl', {param1: 'SomeValue', param2: 'AnotherValue'}, function(response) {
    console.log(response);
});