Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 忽略asmx web服务中的参数_C#_Api_Web Services_Asmx - Fatal编程技术网

C# 忽略asmx 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

我创建了以下web服务

>         [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方法时,您需要获取特定的签名,客户机和服务器将根据该签名交换消息。但它不能传递可选参数。您可以在服务器端使用默认参数,但没有可选参数