I have a web service that provides two interfaces. One is "MyAppNameData" and the other is "MyAppNameSync". I am adding two service references to a WPF application. In the code, when I use "MyAppNameData" reference, I don't get an error. When I use "MyAppNameSync" the following error is generated:
Could not find default endpoint element that references contract 'MyAppNameSync.IMyAppNameSync' 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 contract could be found in the client element.
I added the two references in the exact same way but, MyAppNameData was added using BasicHttpBinding and MyAppNameSync was added with WSHttpBinding. I don't know why that is the case.
Here is the serviceModel element from the client's app.config file. As you can see, there is an endpoint element that references the contract 'MyAppNameSync.IMyAppNameSync', contrary to what the error message says:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMyAppNameData"
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>
<wsHttpBinding>
<binding name="WSHttpBinding_IMyAppNameSync" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows"
proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows"
negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://computername.domainname.home/MyAppNameSyncService/MyAppNameData.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IMyAppNameData"
contract="MyAppNameData.IMyAppNameData"
name="BasicHttpBinding_IMyAppNameData" />
<endpoint address="http://computername.domainname.home/MyAppNameSyncService/MyAppNameSync.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyAppNameSync"
contract="MyAppNameSync.IMyAppNameSync"
name="WSHttpBinding_IMyAppNameSync">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
Any recommendations would really be appreciated.
Thanks