webservice自定义wsdl如何使用(高手进)
我自己拿txt写了个wsdl文件,然后我的.asmx文件因为如下:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(Name = "ChildQueryPort", Location = "ChildQueryService.wsdl")]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
[SoapDocumentMethod(Action = "http://tempuri.org/queryChildrenByCodes", Binding = "ChildQueryPortBinding")]
public String queryChildrenByCodes(String user, String password, string[] codes)
{
//业务处理(主要是查询数据库)
}
}
我把我写的wsdl文件引入项目放到和.asmx同一个目录,然后在浏览器中查看.asmx文件,报如下错误:
类型“ChildQueryService.Service1”缺少定义名为“ChildQueryPortBinding”的绑定的 WebServiceBinding 属性。
参数名: methodInfo
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ArgumentException: 类型“ChildQueryService.Service1”缺少定义名为“ChildQueryPortBinding”的绑定的 WebServiceBinding 属性。
参数名: methodInfo
不知道如何解决,忘高手指教!!!!!!