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
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.