在使用代理类使用WCF服务方面需要帮助!! [英] Need Help on consuming WCF Service using proxy class!!

查看:91
本文介绍了在使用代理类使用WCF服务方面需要帮助!!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经创建了WCF服务,并通过添加服务引用(添加服务引用")从ASP.Net Web应用程序中使用了它,并且在创建了该引用的对象之后,我能够访问WCF服务的方法.

我正在尝试通过创建代理类来尝试使用WCF服务的另一种实现,为此,我按照以下步骤操作:

Hi,

I have created WCF service and consumed it from ASP.Net web application by adding Service reference("Add Service Reference") and after creating object of this reference I am able to access methods of WCF service.

I was trying another implementation of consuming WCF service by creating proxy class, for achieving this I followed steps below :


  1. 创建了WCF服务.
  2. 创建了使用ASP.Net表单使用WCF服务的客户端.
  3. 添加了对"System.ServiceModel"命名空间的引用.
  4. 使用带有配置文件的"Svcutil.exe"创建代理类.
  5. 在ASP.net项目中添加了生成的代理文件,例如generatedProxy.vb.
  6. 尝试创建代理类的对象(generatedProxy)但是在这里我无法获得代理类本身.

  1. Created WCF Service.
  2. Created Client for consuming WCF service using ASP.Net form.
  3. Added reference of "System.ServiceModel" namespace.
  4. Created proxy class using "Svcutil.exe" with config file.
  5. Added generated proxy file say generatedProxy.vb in ASP.net project.
  6. Tried creating object of proxy class (generatedProxy) but here I am not able to get the proxy class itself.


请提出建议,如果我错过了任何步骤.


Please suggest, If I missed out any step.

推荐答案

您的步骤就可以了.
您需要在使用者类(尝试使用代理的类)中添加代理类的名称空间.
Your steps look ok.
You need to add the namespace of your proxy class in the consumer class (the class that is trying to use the proxy).


如果您的应用程序找不到该类,请执行此操作:

1.键入客户端类名称(如果确定).
2.单击班级名称的某个位置.
3.按Ctrl + Shift + F10,然后输入.它将添加必要的名称空间.

如果这不起作用,请在代理类中搜索以client结尾的类名,并将其与必需的名称空间一起使用.
If your application is not able to find the class, do this:

1. Type the client class name (if you are sure about it).
2. Click somewhere on the class name.
3. Press Ctrl + Shift + F10 and then enter. It will add the necessary namespace.

If this does not works, search for a class name ending with client in the proxy class and use that along with required namespace inclusion.


这篇关于在使用代理类使用WCF服务方面需要帮助!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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