【发布时间】:2012-04-25 16:40:33
【问题描述】:
我已将代理添加到 VS2010/.NET 4 解决方案的 Web 服务。我的机器是windows 7操作系统。构建客户端.NET时抛出这个错误:
找不到名为“FulfilmentServicesSoap”的端点元素,并且 合同中的“FulfimentServiceSoap.FulfilmentServicesSoap” ServiceModel 客户端配置部分。这可能是因为没有 为您的应用程序找到了配置文件,或者因为没有 可以在客户端中找到匹配此名称的端点元素 元素。
我在这里找到了一个关于 SO 的类似问题:
Could not find default endpoint element
但是,阅读本文并尝试一些答案对我没有用。我已经多次编辑 app.config 文件,包括:
contract="IFulfimentServiceSoap" name="FulfilmentServicesSoap" />
和
contract="FulfimentServiceSoap.FulfilmentServicesSoap" name="FulfilmentServicesSoap" />
和
contract="MYFullNamespace.FulfimentServiceSoap.FulfilmentServicesSoap" name="FulfilmentServicesSoap" />
但是,在每种情况下,当我运行我的 Web 服务时,即使我编辑了配置文件,事件查看器也会显示合同“FulfimentServiceSoap.FulfilmentServicesSoap”。我还必须做些什么来获取 app.config 文件中的更改或有任何其他想法吗?
编辑 - 从 app.config 添加绑定信息
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="FulfilmentServicesSoap" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/WLR3.Web.services/FulfilmentServices.asmx"
binding="basicHttpBinding" bindingConfiguration="FulfilmentServicesSoap"
contract="FulfimentServiceSoap.FulfilmentServicesSoap"name="FulfilmentServicesSoap" />
</client>
</system.serviceModel>
EDIT - 创建客户端的代码。
FulfimentServiceSoap.FulfilmentServicesSoap fulfilmentServices = new FulfimentServiceSoap.FulfilmentServicesSoapClient("FulfilmentServicesSoap");
【问题讨论】:
-
没有发布更多信息(配置),很难提供帮助。
-
你的app.config、web.config...需要绑定配置。
-
编辑了问题以在 app.config 中包含绑定配置 - 我可以在 IE 中点击 localhost 上的 asmx 页面
-
好的,包括你如何创建你的客户端的代码。
-
添加的代码是创建客户端。
标签: .net wcf wcf-binding endpoint