如何在WCF Rest Service中传递多个参数:C#中的字符串和流

问题描述 投票:0回答:1

我有一个WCf rest服务,它具有两个输入参数:string和Stream:

[OperationContract]      
[WebInvoke(Method = "POST", UriTemplate = "ImportStream/{Separator}", ResponseFormat = 
WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
void ImportStream(string Separator, stream data);

我的代码:

public void ImportStream (string Separator, Stream inputpar)
{ //...
}

我的目标是使用POSTMAN调用服务:https://localhost:44355/ServiceLias.svc/rest/ImportStream/Comma

并且在主体中,我将Stream编写为Text,

但是我从一开始就有错误:

For request in operation ImportStream to be a stream the operation must have a single parameter whose type is Stream.

我该如何解决?或者有什么想法可以实现我的目标?谢谢,

c# rest wcf stream
1个回答
0
投票
函数签名的定义不符合在WCF中启用流数据的规则。它违反了以下定义。
© www.soinside.com 2019 - 2024. All rights reserved.