Could not find default endpoint element

edosoft picture edosoft · Dec 9, 2008 · Viewed 356.4k times · Source

I've added a proxy to a webservice to a VS2008/.NET 3.5 solution. When constructing the client .NET throws this error:

Could not find default endpoint element that references contract 'IMySOAPWebService' in the ServiceModel client configuration section. This might be because no configuaration file was found for your application or because no endpoint element matching this contract could be found in the client element.

Searching for this error tells me to use the full namespace in the contract. Here's my app.config with full namespace:

<client>
  <endpoint address="http://192.168.100.87:7001/soap/IMySOAPWebService"
            binding="basicHttpBinding" bindingConfiguration="IMySOAPWebServicebinding"
            contract="Fusion.DataExchange.Workflows.IMySOAPWebService" name="IMySOAPWebServicePort" />
</client>

I'm running XP local (I mention this because a number of Google hits mention win2k3) The app.config is copied to app.exe.config, so that is also not the problem.

Any clues?

Answer

L.R. picture L.R. · Apr 29, 2010

"This error can arise if you are calling the service in a class library and calling the class library from another project."

In this case you will need to include the WS configuration settings into the main projects app.config if its a winapp or web.config if its a web app. This is the way to go even with PRISM and WPF/Silverlight.