我正在尝试使用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's DevToolBox[^] 3. Generating WCF/WebService proxy class using SvcUtil.exe - Nithin Mohan T K's blog space[^]更多推荐
使用svcutil.exe添加服务引用
发布评论