Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在启用 AJAX 的 WCF 服务中定义多个函数?例如:
[OperationContract] public string GreetUser(string uname) { return "Hello " + uname; } public string DeleteUser(string uname) { return "Hello " + uname; }
只需在[OperationContract]上面添加一个DeleteUser.
[OperationContract]
DeleteUser
请注意,您不能使用 WCF 服务重载函数/方法。名称必须是唯一的。您可以更改 OperationContract Name 属性以修复重载的函数/方法。