I've got a curious problem, where I'm trying to connect a WCF service to a WCF application I'm getting errors. Seperately both WCF components work without fault with the WCF Test Client & a Winforms Test Harness I've created.
Here is the call I make within the WCF service (client) to the service reference pointed at my WCF app (server).
EventCreationServiceReference.EventCreationServicePortClient _servicereference =
new EventCreationServiceReference.EventCreationServicePortClient();
Now I'm connecting in the same way as the Test Harness does, the only difference I can think is the Test Harness is a plain Winforms Application with service references, whereas this is a WCF Service talking to a Winforms application with a WCF interface.
The Error;
Could not find endpoint element with name 'EventCreationApp.IEventCreationServicePort'
and contract 'EventCreationAppServiceReference.IEventCreationServicePort' 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.
Now I was wondering why the contract was not found so I've tried creating the service reference stating the service reference contract explicity, but I was presented with a very similar error.
Uri uri = new Uri("net.tcp://172.26.2.11:8525/EventCreationApp");
EndpointAddress endpointAddress = new EndpointAddress(uri);
EventCreationServiceReference.EventCreationServicePortClient _servicereference =
new EventCreationAppServiceReference.EventCreationServicePortClient(
"EventCreationAppServiceReference.IEventCreationServicePort", endpointAddress);
Here is my WCF configuration for the WCF Application;
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="EventCreationApp.IEventCreationServicePort" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="EventCreationApp.Service1Behavior"
name="EventCreationApp.EventCreationServicePort">
<endpoint address="" binding="netTcpBinding"
bindingConfiguration="EventCreationApp.IEventCreationServicePort"
contract="EventCreationApp.IEventCreationServicePort"
name="EventCreationApp.IEventCreationServicePort">
<identity>
<dns value="172.26.2.11" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://172.26.2.11:8525/EventCreationApp" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="EventCreationApp.Service1Behavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
...and the WCF service client service reference code for connecting to the application.
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="EventCreationApp.IEventCreationServicePort" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://172.26.2.11:8525/EventCreationApp"
binding="netTcpBinding" bindingConfiguration="EventCreationApp.IEventCreationServicePort"
contract="EventCreationAppServiceReference.IEventCreationServicePort"
name="EventCreationApp.IEventCreationServicePort">
<identity>
<dns value="172.26.2.11" />
</identity>
</endpoint>
</client>
</system.serviceModel>
Help, I'm completely stumped.
Shouldn't the client config contain 'Client' end points?
[Edit]
You are saying that WCF service is talking to WCF application. Shouldn't it be reverse?
Or are you saying WCF Service is the client and WCF application is the service?