I have a wcf service and i install it as windows service. I can access this service from 192.168.2.6 machine:
"net.tcp://192.168.2.5:2025/Services/mex".
i want to access this service from another computer using static ip and port.
How can access this service ?
I tried to connect net.tcp://staticIp:port/Services/mex and i got error :
Metadata contains a reference that cannot be resolved: 'net.tcp://[staticIP]:[port]/Services/mex'.If the service is defined in the current solution, try building the solution and adding the service reference again.
(I navigate my [port] to inside port 2025)
my config:
<system.serviceModel>
<diagnostics>
<messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IServices" />
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://192.168.2.5:2025/Services" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IServices" contract="myServices.IServices"
name="NetTcpBinding_IServices">
<!--<identity>
<dns value="localhost" />
</identity>-->
</endpoint>
</client>
<services>
<service name="F8ShadowWcfLib.Services">
<endpoint address="" binding="netTcpBinding" bindingConfiguration=""
contract="F8ShadowWcfLib.IServices">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://192.168.2.5:2025/Services" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
Edit1:
I remove tag from config and i add it at runtime.
myService.ServicesClient myServ = new myService.ServicesClient();
EndpointAddress myEndpointAdd = new EndpointAddress(new Uri("net.tcp://[staticIP]:[port]/Services") ,
EndpointIdentity.CreateDnsIdentity("net.tcp://f8srv.f8.com.tr:2299/Services"));
myServ.Endpoint.Address = myEndpointAdd;
I got different error : The server has rejected the client credentials.
To allow seperate connection set AddressFilterMode : Any and set your identy both service and client side.
This article about identy settings:
http://msdn.microsoft.com/en-us/library/ms733130.aspx
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
public class Services : IServices
{
.
.
.
}