简体   繁体   English

方法未在WCF客户端中显示

[英]Methods not showing up in WCF Client

I created a WCF ServiceContract with a few methods but when I add the reference to the client none of them show up. 我用几种方法创建了WCF ServiceContract,但是当我将引用添加到客户端时,它们都没有出现。 The WCF Test Client loads correctly and all the methods show up there. WCF测试客户端正确加载,并且所有方法都显示在此处。 They also show up in the 'Add Service Reference' window when I try to add the service reference and click 'Go' ('Discover' does not bring anything up). 当我尝试添加服务参考并单击“执行”时,它们还会显示在“添加服务参考”窗口中(“发现”不会显示任何内容)。 What may be keeping the Interface on the client side empty? 客户端的接口可能保持空白的原因是什么?

Here is the code for the service with one method: 这是使用一种方法的服务代码:

namespace WS
{
 [ServiceContract]
  public interface Itest
  {
    [OperationContract] method_name(int num);
 }
}   

The client app recognizes the namespace but does not find any methods in it. 客户端应用可以识别名称空间,但无法在其中找到任何方法。

Thanks! 谢谢!

Can you try using svcutil.exe and see if you are able to create a proxy file. 您可以尝试使用svcutil.exe来查看是否能够创建代理文件。 If you are then you can try referencing that in you client project. 如果是这样,则可以尝试在客户端项目中引用它。

something like: 就像是:

  svcutil.exe <<url where service is deployed>> /o:ClientProxy.cs

Try following things. 尝试遵循以下步骤。

  1. Make sure your service is working using test client in visual studio. 确保您的服务在Visual Studio中使用测试客户端正常工作。

  2. Update your service reference by right clicking on it. 右键单击以更新您的服务参考。

  3. Or delete it and add new service reference again. 或将其删除并再次添加新的服务参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM