找不到名称为“'”的端点元素和契约“我”;在 ServiceModel 客户端配置部分。
我正在开发基本 WCF 服务-客户端 WCF 服务-消费者基础 Wcf servcie 模型,如下所示:
>在这个模型中,我创建了一个 Base WCF 服务并创建了 1 个 WCF 服务,即; ClientWCFService 和 1 个 ASMX 服务,即; ClientASMXservice 使用 BaseWCFServiceProxy.cs 使用 SVCUtil.exe 的 Base WCF Service 的 Proxy 类。
ClientWCFService 和 ClientASMXservice 在独立环境中工作正常。 现在,我使用相同的代理类 BaseWCFServiceProxy.cs 创建了一个消费者控制台应用程序,以使用 BaseWcfService 类访问 ClientWCFService 和 ClientASMXservice。
根据OOP规则,BaseWcfService类是ClientWCFService和ClientASMXservice的基类,我可以使用Base服务类构造函数访问这些服务。
服务调用如下: 对于 ClientWCFService
ModelWcfServiceContractClient _client = new ModelWcfServiceContractClient("IModelWcfServiceContract","http://localhost:64242/ClientWCFServiceWcfUsingSVCProxy.svc");
对于 ClientASMXservice
ModelWcfServiceContractClient _client = new ModelWcfServiceContractClient("IModelWcfServiceContract","http://localhost:64396/ClientASMXServiceWcfUsingSVCProxy.asmx");
消费者控制台应用程序构建良好,但在运行时初始化 ModelWCFServiceContractClient 对象时, 它抛出InvalidOperation Exception:
找不到名称为“IModelWcfServiceContract”的端点元素 并在 ServiceModel 客户端中签订合同“IModelWcfServiceContract” 配置部分。这可能是因为没有配置文件 为您的应用程序找到,或者因为没有端点元素匹配 该名称可以在客户端元素中找到。
我尝试对每种类型的服务使用不同的端点来解决此问题,但未能成功。
如果有更快的响应,我们将不胜感激。另外,请不要仅仅通过清除拼写错误来帮助我,因为这会浪费我的时间来阅读由于清除拼写错误而生成的警报。时间对我来说很重要..
谢谢
I am working on a Base WCF Service- Client WCF service - Consumer Base Wcf servcie model as following:
In this model, I have created a Base WCF service and created 1 WCF service i.e; ClientWCFService and 1 ASMX service i.e; ClientASMXservice using the BaseWCFServiceProxy.cs the Proxy class of Base WCF Service using SVCUtil.exe.
The ClientWCFService and ClientASMXservice are working fine in StandAlone environment.
Now, I created a Consumer Console Application using the same proxy class BaseWCFServiceProxy.cs to access both of the ClientWCFService and ClientASMXservice using the BaseWcfService class.
As per the OOP rules, BaseWcfService class is the base class for the ClientWCFService and ClientASMXservice and i can access these Services using the Base service class constructor.
The service calls are as following:
for ClientWCFService
ModelWcfServiceContractClient _client = new ModelWcfServiceContractClient("IModelWcfServiceContract","http://localhost:64242/ClientWCFServiceWcfUsingSVCProxy.svc");
for ClientASMXservice
ModelWcfServiceContractClient _client = new ModelWcfServiceContractClient("IModelWcfServiceContract","http://localhost:64396/ClientASMXServiceWcfUsingSVCProxy.asmx");
The Consumer Console application is building fine, but at run time while initializing the ModelWCFServiceContractClient object,
it throws the InvalidOperation Exception as :
Could not find endpoint element with name 'IModelWcfServiceContract'
and contract 'IModelWcfServiceContract' 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 name could be found in the client element.
I have tried using different endpoints for every type of service to resolve this issue but could not get success.
A faster response would be Appreciated. Also please don't help me by just clearing spelling mistakes because it will waste my time to read the Alert that would be generated due to the clearing spell mistakes. Time is critical for me..
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试一下(希望您能遵循):
在 Visual Studio 中,选择包含
ModelWcfProxy
的 ServiceReference 的项目(生成ModelWcfServiceContractClient
代理类的项目)。从解决方案资源管理器菜单栏中选择“显示所有文件”。
展开服务引用文件夹和生成的服务引用。找到 .svcmap 文件,在下面查找 Reference.cs 文件。
在生成的界面的顶部应该定义一个 System.ServiceModel.ServiceContractAttribute 。在属性构造函数中,您应该看到正在设置的 ConfigurationName 属性。此协定配置名称应与配置中定义的名称或您发送到方法的名称相匹配:
ModelWcfServiceContractClient _client = new ModelWcfServiceContractClient("IModelWcfServiceContract","http://localhost:64242/ClientWCFServiceWcfUsingSVCProxy.svc");< /code>
希望这有帮助。
Try this (hopefully you can follow):
In Visual Studio, Select the project that contains the ServiceReference for your
ModelWcfProxy
(the one that generated theModelWcfServiceContractClient
proxy class).Choose, "Show all files" from the Solution Explorer menu bar.
Expand the Service References folder and the generated Service Reference. Find the .svcmap file, look underneath to find the Reference.cs file.
On the top of your generated interface there should be a
System.ServiceModel.ServiceContractAttribute
defined. In the attribute constructor, you should see a ConfigurationName property being set. This contract configuration name should match the name defined in config or that you are sending in to your method:ModelWcfServiceContractClient _client = new ModelWcfServiceContractClient("IModelWcfServiceContract","http://localhost:64242/ClientWCFServiceWcfUsingSVCProxy.svc");
Hope this helps.