Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
以流作为另一个参数将复杂类型传递给WCF Rest服务_Wcf_Rest - Fatal编程技术网

以流作为另一个参数将复杂类型传递给WCF Rest服务

以流作为另一个参数将复杂类型传递给WCF Rest服务,wcf,rest,Wcf,Rest,我正在尝试使用visual studio 2012和.net framework 4.5创建wcf rest服务。该服务将尝试上载包含4个或更多参数的文件。我只想在一个电话里完成。我想使用http“put”方法。但我一直有这两个错误 合约“IRestBasketService”中的操作“AddFile”具有多个请求正文参数,其中一个是流。当流是一个参数时,主体中不能有其他参数 (当我使用BodyStyle wrapped时) 及 契约“IRestBasketService”的操作“AddFile

我正在尝试使用visual studio 2012和.net framework 4.5创建wcf rest服务。该服务将尝试上载包含4个或更多参数的文件。我只想在一个电话里完成。我想使用http“put”方法。但我一直有这两个错误

合约“IRestBasketService”中的操作“AddFile”具有多个请求正文参数,其中一个是流。当流是一个参数时,主体中不能有其他参数

(当我使用BodyStyle wrapped时)

契约“IRestBasketService”的操作“AddFile”指定要序列化的多个请求正文参数,而不使用任何包装器元素。在没有包装器元素的情况下,最多可以序列化一个主体参数。删除额外的主体参数或将WebGetAttribute/WebInvokeAttribute上的BodyStyle属性设置为Wrapped

(当我使用BodyStyle裸体时)

我该怎么办

下面是给我错误的两个签名

[WebInvoke(Method = "PUT",
BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "AddFile?key={key}&email={email}&fileName={fileName}&groupID={groupID}&ID=   {objectID}")]
Response AddFile(string key, string email, string fileName, string type, string objectID,   string  groupID, Stream fileStream );

[WebInvoke(Method = "PUT",
BodyStyle = WebMessageBodyStyle.Wrapped,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
UriTemplate = "/AddFile")]
Response AddFile(AddFileRequest request, Stream FileStream);
我在web.config中使用webHttpBinding和webHttp行为