使用svcutil.exe添加服务引用

编程入门 行业动态 更新时间:2024-10-25 07:26:23
本文介绍了使用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 合同 = IData name = NetTcp Binding_IData > < 身份 > < userPrincipalName value = xxx@xxx / > < / 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;博客空间 [ ^ ]

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" /> </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添加服务引用

本文发布于:2023-11-05 07:37:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560263.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:svcutil   exe

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!