如何生成将在.net 2.0中工作的wcf服务的客户端代理类 [英] how to generate client proxy class of a wcf service that will work in the .net 2.0

查看:138
本文介绍了如何生成将在.net 2.0中工作的wcf服务的客户端代理类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在BIDS 2005中开发的sis脚本组件中使用wcf服务.为此,我已经使用svcutil.exe生成了该服务的代理类.在脚本组件中附加代理类后,它具有某些类的错误,例如未定义System.Runtime.Serialization.DataContractAttribute.任何建议,我该如何解决此问题.或者可以使用wsdl来生成wcf服务的代理类.以便可以在.net 2.0中使用.

I have to use a wcf service in the ssis script component which is developing in BIDS 2005. For this i have generated the proxy class of that service using svcutil.exe. After attaching the proxy class in the script component it has error of some class such as System.Runtime.Serialization.DataContractAttribute is not defined. Any suggestion how can i resolve this issue.. Or can wsdl is used to genrate proxy class of wcf service. so that it can be used in the .net 2.0.

谢谢

推荐答案

最后,在为此苦苦挣扎之后,我已经解决了这个问题.现在,我已经成功创建了wcf服务的代理类,并且它现在也可以在.net 2.0中使用.

Finally after much struggling over it, i have resolved the issue. Now i have successfully created the proxy class of the wcf service and also it is now working in .net 2.0.

我已经完成了以下步骤:-

I have gone through the following steps:--

注意:仅当wcf sercice(.svc)使用与Webservice(.asmx)类似的BasicHttpBinding时,此方法才有效

Note: this will work only if the wcf sercice(.svc) will be using BasicHttpBinding which is similar to webservice (.asmx)

第1步:- 在Visual Studio命令提示符下运行以下命令.

Step1:- run the following command on the visual studio command prompt.

svcutil.exe /target:metadata http://Your service address

它将在路径C:\Program Files\Microsoft Visual Studio 10.0\VC

第2步:- 现在运行wsdl命令

Step2:- Now run the wsdl command

wsdl.exe tempuri.org.wsdl tempuri.org.xsd schemas.microsoft.com.2003.10.Serialization.xsd

这将生成可用于访问服务的v2.0客户端代理类.

This will generate a v2.0 client proxy class that can be used to access the service.

注意:如果wsdl命令中发生某些错误,请使用所有文件名,而不要使用空格将这三个文件分开.

Note: if some error occurs in the wsdl command, Use all the files name instead of using these three separated by space..

这篇关于如何生成将在.net 2.0中工作的wcf服务的客户端代理类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆