如何在WCF Rest Service中传递多个参数?

我正在用C#开发WCF REST服务。 它适用于单个参数。 现在我需要扩展它以支持多个参数。 请帮我解决这个问题。

提前致谢…

在界面中使用以下声明:

[OperationContract] [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.WrappedRequest, UriTemplate = "login")] resLogin Login(reqLogin rData, int floorId); 

看看UriTemplate参数 。 您可以使用QueryString或URL路径传入floorId参数。

URI路径参数

 [WebInvoke(Method = "POST", UriTemplate = "login/floor/{floorId}")] resLogin Login(reqLogin rData, int floorId); 

QueryString参数

 [WebInvoke(Method = "POST", UriTemplate = "login?floorId={floorId}")] resLogin Login(reqLogin rData, int floorId); 

在OperationContract上添加BodyStyle

 [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest)]