i get this error while trying to access a WCF service hosted in iis (locally) from a c# client:
Could not find endpoint element with name 'X' and contract 'Contract Name' 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.
This is the client's app.config (it is a NUnit fixture just to test connection):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_MyWs" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://localhost/MyWs/MyWs.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_MyWs"
contract="MyServiceSvc.IMyWs"
name="BasicHttpBinding_MyWs" />
</client>
</system.serviceModel>
</configuration>
If i browse
https://localhost/MyWs/MyWs.svc?wsdl
i get correct output so the server part is working fine.
Moreover, i can test my ws with soapUI so the problem must be in the client, maybe in the app.config.
My client code, just in case someone wants tolook at it:
[TestFixture]
public class MyWsProxyFixture
{
private readonly MyWsClient _client = new MyWsClient();
[Test]
public void ProxyCreation()
{
Assert.IsNotNull(_client);
}
//More tests here
}
Even funnier, the exact same configuration and client works in another machine. Yes it is true. I cannot believe it myself but so it is.
Can you give some hints or suggestions to work this out?
Thanks!
PS: the service reference in the client is fine.