WCF服务具有2个或更多参数

发布于 2025-01-25 13:16:36 字数 149 浏览 1 评论 0原文

我必须创建一个执行查询的WCF服务(目前没有问题)。我的问题是,此查询需要两个参数,用户将用户键入Web表单并使用按钮提交。如何将这两个参数从Web表单传递给服务?我只创建了仅接收一个参数的服务,不超过一个参数 这是我唯一的问题,我能够阅读JSON结果并以形式组织

很多

I have to create a WCF service that executes a query (no problem at the moment). My problem is that this query needs two parameters that the user types into a web form and submits with a button. How can I pass those 2 parameters from the web form to the service? I have only created services that receive only one parameter, not more than one
This is my only problem, I'm be able to read the JSON result and organize it in the form

Thaks a lot

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自演自醉 2025-02-01 13:16:36

我认为您可以使用 a>,

uritemplate是封装URI模板的类。构造函数采用定义模板的字符串参数。
喜欢:

[ServiceContract]  
interface ICustomer  
{  
  //"View It" -> HTTP GET  
    [WebGet( UriTemplate="customers/{id}" )]  
  Customer GetCustomer( string id ):  
  
  //"Do It" -> HTTP PUT  
  [WebInvoke( UriTemplate="customers/{id}", Method="PUT" )]  
  Customer UpdateCustomer( string id, Customer newCustomer );  
}  

有用的链接:

uriemplate和uritemplatetable

如何使用asp.net中的c#在WCF RESTFULE服务上传递多个参数

I think you can use UriTemplate,
UriTemplate is a class that encapsulates a URI template. The constructor takes a string parameter that defines the template.
like :

[ServiceContract]  
interface ICustomer  
{  
  //"View It" -> HTTP GET  
    [WebGet( UriTemplate="customers/{id}" )]  
  Customer GetCustomer( string id ):  
  
  //"Do It" -> HTTP PUT  
  [WebInvoke( UriTemplate="customers/{id}", Method="PUT" )]  
  Customer UpdateCustomer( string id, Customer newCustomer );  
}  

Useful links:

URI Processing with UriTemplate and UriTemplateTable

How to pass multiple parameters on WCF Restful service using C# in ASP.Net

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文