C# 忽略asmx web服务中的参数
我创建了以下web服务C# 忽略asmx web服务中的参数,c#,api,web-services,asmx,C#,Api,Web Services,Asmx,我创建了以下web服务 > [WebMethod(EnableSession = true)] > > public Transaction<Employee> GetEmployee(string Fname, string Lname, int eid) > { > > return _service.GetEmployee(Fname, L
> [WebMethod(EnableSession = true)]
>
> public Transaction<Employee> GetEmployee(string Fname, string Lname, int eid)
> {
>
> return _service.GetEmployee(Fname, Lname, apartmentTypeId, eid);
> }
[WebMethod(EnableSession=true)]
>
>公共事务GetEmployee(字符串Fname、字符串Lname、整数eid)
> {
>
>return _service.GetEmployee(Fname、Lname、apartmentTypeId、eid);
> }
我想将最后一个参数设置为可选。现在,我不是,我不是
提交eid时,它给出了一个错误。我怎样才能做最后一个
此服务中的参数是否可选
你不能。Web方法不支持可选参数。当您生成proxi for web方法时,您需要获取特定的签名,客户机和服务器将根据该签名交换消息。但它不能传递可选参数。您可以在服务器端使用默认参数,但没有可选参数