使用svcutil.exe添加服务引用 [英] Adding service refernce using svcutil.exe

查看:102
本文介绍了使用svcutil.exe添加服务引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用svcutil.exe向classlibrary添加WCF服务引用



我的WCF服务托管在Windows应用程序表单中。



以下是我得到的错误:



Quote:

找不到引用ServiceModel客户端配置部分中的合同IData的默认端点元素。这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此合同匹配的端点元素。





这里是我的App.config文件:



 <   system.serviceModel  >  
< 绑定 >
< netTcpBinding >
< binding name = NetTcpBinding_IData >
< reliableSession inactivityTimeout = 01:00:00 已启用 = true / >
< / binding >
< / netTcpBinding >
< / bindings >
< ; 客户 >
< endpoint 地址 = net.tcp:// localhost:8182 / binding = netTcpBinding

bindingConfiguration = NetTcpBinding_IData 合同 < span class =code-keyword> = IData
< span class =code-attribute>
name = NetTcp Binding_IData >
< 身份 >
< userPrincipalName value = xxx@xxx.com / >
< / identity >
< / endpoint >
< / client >
< / system.serviceModel >





我尝试过:



请建议我如何解决这个问题。

解决方案

参考这些文章,

1. 3为WCF服务生成代理的方法 [ ^ ]

2 。为WCF服务创建代理类使用svcutil.exe | Shahid Afzal&#039; DevToolBox [ ^ ]

3. 使用SvcUtil.exe生成WCF / WebService代理类 - Nithin Mohan T K&#039;博客空间 [< a href =http://www.nitrix-reloaded.com/2011/02/22/generating-wcfwebservice-proxy-class-using-svcutil-exe/target =_ blanktitle =New Window> ^ ]

I am trying to add WCF service Reference to classlibrary using svcutil.exe

My WCF Service is hosted in Windows Application Form.

The following is the error i am getting:

Quote:

Could not find default endpoint element that references contract 'IData' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.



Here is my App.config file:

<system.serviceModel>
      <bindings>
        <netTcpBinding>
          <binding name="NetTcpBinding_IData">
            <reliableSession inactivityTimeout="01:00:00" enabled="true" />
          </binding>
        </netTcpBinding>
      </bindings>
      <client>
        <endpoint address="net.tcp://localhost:8182/" binding="netTcpBinding"

            bindingConfiguration="NetTcpBinding_IData" contract="IData"

            name="NetTcpBinding_IData">
          <identity>
            <userPrincipalName value="xxx@xxx.com" />
          </identity>
        </endpoint>
      </client>
    </system.serviceModel>



What I have tried:

please suggest me how to solve this issue.

解决方案

Refer these articles,
1. 3 Ways to generate proxy for WCF Service[^]
2. Create Proxy Class For WCF Service Using svcutil.exe | Shahid Afzal&#039;s DevToolBox[^]
3. Generating WCF/WebService proxy class using SvcUtil.exe - Nithin Mohan T K&#039;s blog space[^]


这篇关于使用svcutil.exe添加服务引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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