WCF Client on the same network not working - wcf

I created a simple Chat app.
On the same computer everything working.
On the other computer on the same network it's not.
Here is the config file of the server:
<service name="ChattingServer.ChattingService">
<endpoint address="net.tcp://localhost:9000/ChattingService "
binding="netTcpBinding" bindingConfiguration="" name="ChattingServiceEndPoint"
contract="ChattingInterfaces.Contract.IChattingService" />
</service>
And this is the config file of the client:
<client>
<endpoint address="net.tcp://localhost:9000/ChattingService" binding="netTcpBinding"
bindingConfiguration="" contract="ChattingInterfaces.Contract.IChattingService"
name="ChattingServiceEndPoint" kind="" endpointConfiguration="" />
</client>
This on the same computer working just fine!
Now for the client on a different machine i changed the config file to this:
<client>
<endpoint address="net.tcp://10.0.0.3:9000/ChattingService" binding="netTcpBinding"
bindingConfiguration="" contract="ChattingInterfaces.Contract.IChattingService"
name="ChattingServiceEndPoint" kind="" endpointConfiguration="" />
</client>
Changed just the ip.
I have ping back and forth, i shut down the firewall on both, no anti virus on both, both run win7 as admin, try with the name of the pc insted of the ip as well - not working.
The computers working on WiFi.
What can i do?
Thanx

Related

WCF A call to SSPI failed, 'the target principal name is incorrect'

I'm getting this dreaded message and have spent a fair bit of time reading about it but have still been unable to solve it
I have a console app running on my client trying to invoke a WCF service on a different machine. The service is running under a domain account. I believe under this scenario it tries to authenticate using Kerberos
I have also read that if you supply a dummy serviceprincipalname on the client
<servicePrincipalName value="MySystem/Service1"/>
then it will fall back to using ntml.
I have tried this without luck. If the client is on the same machine as the service then it works fine. Not sure what else I can try. Here is the config on my client
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_HelpersService" />
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://myserver/SPInterface/HelpersService.svc/TCP" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_HelpersService"
contract="HelpersService" name="NetTcpBinding_HelpersService">
<identity>
<servicePrincipalName value="MySystem/Service1"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
What I also don't understand is that if I use the WCFTestClient in Visual Studio which generates the same config file from my local machine it works fine
My server config files has this in it:-
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
<serviceActivations>
<add relativeAddress="HelpersService.svc" service="SPInterface.Models.HelpersService" factory="SPInterface.WebService.HelpersServiceHostFactory"/>
</serviceActivations>
</serviceHostingEnvironment>
<services>
<service name="SPInterface.Models.HelpersService" behaviorConfiguration="Debug">
<endpoint address="TCP" binding="netTcpBinding" bindingNamespace="http://Server/SPInterface/Services" contract="SPInterface.Contracts.IHelpersService"/>
<endpoint address="Rest" binding="webHttpBinding" bindingNamespace="http://Server/SPInterface/Services" contract="SPInterface.Contracts.IHelpersService" behaviorConfiguration="Rest"/>
</service>
</services>
</system.serviceModel>
The inner exception is "the target principal name is incorrect"

WCF client cannot connect to WCF service hosted in IIS via ServiceHost?

I have this scheme:
IIS
hosts: OperatorService.svc (connects to ClientService)
Global.asax (on start): hosts ClientService via ServiceHost
WPF client
connects to ClientService
If I go to OperatorService the service is activated, web application started, and ClientService is successfully hosted at http://localhost:8020/ClientService. So far so good.
I can now access the ClientService in the aforementioned URL in a browser, I can add it through Add Service Reference. It's simply there - running.
But when I try to connect via generated client (looks OK), it suddenly doesn't work. Throwing:
There was no endpoint listening at http://localhost:8020/ClientService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Moreover the OperatorService connects to this ClientService itself (it is a WsDualHttpBinding to provide notifications). It subscribes itself correctly to this service (calling a method) and it works (same URL as my WPF client).
Why can't I connect from my WPF client?
WPF client config (only relevant sections):
<client>
<endpoint address="http://localhost:8020/ClientService" binding="wsDualHttpBinding"
bindingConfiguration="DefaultBindingClientService" contract="Server.IClientService"
name="DefaultBindingClientService">
<identity>
<servicePrincipalName value="host/OHS-UPC" />
</identity>
</endpoint>
</client>
<bindings>
<wsDualHttpBinding>
<binding name="DefaultBindingClientService" />
</wsDualHttpBinding>
</bindings>
IIS hosted web.config (for ClientService)
<service name="TelPro.OHS.Server.Services.ClientService" behaviorConfiguration="UnsecuredBehavior">
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="DefaultBindingClientService" contract="TelPro.OHS.Server.Services.IClientService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8020/ClientService"/>
</baseAddresses>
</host>
</service>
<wsDualHttpBinding>
<binding name="DefaultBindingClientService"/>
</wsDualHttpBinding>
<behavior name="UnsecuredBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
IIS hosted web.config (for OperatorService -> ClientService)
<client>
<endpoint address="http://localhost:8020/ClientService" binding="wsDualHttpBinding"
bindingConfiguration="DefaultBindingClientService" contract="ClientNotificationServer.IClientService"
name="DefaultBindingClientService" />
</client>
<wsDualHttpBinding>
<binding name="DefaultBindingClientService" />
</wsDualHttpBinding>
I was able to solve it by switching to port 80.
http://localhost/ClientService
Somehow that works. I've tried to add rules to port 8020 everywhere (even stopped firewall), checked any port forwarding, Azure endpoints, etc. My theory is that the problem when server is trying to connect back (callback) to client and has no rights or something. My guess would be that IIS hosted service doesn't have enough rights to connect back. If anyone can still shed some light on the why, I would gladly switch answer to them. But so far I'm just glad it works regardless the port.

NetNamedPipeBinding create an issue when service is restarted

We are using WCF service with NetNamedPipeBinding binding. It works without any problem.But some time when we replace service's bin in IIS or restart the service then client can not connect with service. During this error If we change the binding from NetNamedPipeBinding to BasicHttpBinding in client side then work perfectly.
Client does not receive the response from the service. So how we can overcome from this issue and just want to know what is the actual issue with NetNamedPipeBinding?
if there is an any better replacement of NetNamedPipeBinding.
Update:
Service side configuration
<services>
<service behaviorConfiguration="ServicesBehavior" name="WcfServices.Service1">
<endpoint address="soap" behaviorConfiguration="FlattenWsdlEndpointBehavior" binding="basicHttpBinding" contract="WcfServices.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="json" behaviorConfiguration="webHttpBehavior" binding="webHttpBinding" contract="WcfServices.IService1" />
<endpoint address="NamedPipe" binding="netNamedPipeBinding" contract="WcfServices.IService1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
Client side configuration
<client>
<endpoint address="http://someAddress/WcfServices/Service1.svc/soap" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" contract="WcfServices.IService1" name="BasicHttpBinding_IService1" />
<endpoint address="net.pipe://localhost/WcfServices/Service1.svc/NamedPipe" binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IService1" contract="WcfServices.IService1" name="NetNamedPipeBinding_IService1" />
</client>
Thanks in advance.
If someone can help me on this.

Debugging a WCF service hosted inside a windows service from an ASP.NET MVC client hosted on local IIS

Friends,
I have a WCF service that i am trying to step into locally from my MVC 2 web client .THe WCF service is hosted inside a windows service inside the same solution .I installed the windows service and made sure that it is running.But when i try to step into the WCF service , i get the following error message
"Cannot step into the remote procedure".
Here is my client and host configurations
Host
<host>
<service name="MyService" behaviorConfiguration="ServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/MyService" />
<add baseAddress="net.tcp://localhost:9002/MyService" />
</baseAddresses>
</host>
<endpoint address="" bindingConfiguration="bigTcpArrayBinding" binding="netTcpBinding" contract="IMyServices" />
<endpoint address="" bindingConfiguration="bigArrayBinding" binding="basicHttpBinding" contract="IMyServices" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</host>
and
client is
<client>
<endpoint address="net.tcp://localhost:9002/MyService" binding="netTcpBinding" bindingConfiguration="bigTcpArrayBinding" contract="LPS.HAMP.MARS.IHampServices" name="SANDBOX_HampServicesSvcContract" />
</client>
I use VS 2010 on windows 7. Any help is greatly appreciated
Thanks
RJ
You can debug a running windows service, go to Debug -> Attach to process -> find the name of the service and VS will attach to this running service.

WCF - Beginners question on Address (of ABC)

I am new to WCF. Following is a question on WCF.
Suppose, I have a service defined as follows.
The host has two addresses. I usually click on the base address http://.... to generate proxy.
When the proxy is generated, will it have address of http alone?
How can I generate a proxy with net.tcp.
Is there any article that explains the use of net.tcp with local host and ASP.NET?
Here's my config:
<service name="XXX.RRR.Common.ServiceLayer.MySL" behaviorConfiguration="returnFaults">
<endpoint
behaviorConfiguration="LargeEndpointBehavior"
binding="netTcpBinding" bindingConfiguration="MessagingBinding"
contract="XXX.RRR.Common.ServiceLayer.IMySL" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:86/XXX/RRR/ManagerService" />
<add baseAddress="http://localhost:76/XXX/RRR/ManagerService" />
</baseAddresses>
</host>
</service>
Thanks
Lijo
What exactly is your issue here?? From your config, I see you don't have any address defined on the service endpoint - you need to supply one!
<service name="XXX.RRR.Common.ServiceLayer.MySL" behaviorConfiguration="returnFaults">
<endpoint
address=""
behaviorConfiguration="LargeEndpointBehavior"
binding="netTcpBinding" bindingConfiguration="MessagingBinding"
contract="XXX.RRR.Common.ServiceLayer.IMySL" />
When you create a client proxy against this service using the http address, then yes, the client side config will have the http endpoint as its address - something like:
<client>
<endpoint name="Default"
address="http://localhost:76/XXX/RRR/ManagerService"
binding="basicHttpBinding"
contract="XXX.RRR.Common.ServiceLayer.IMySL" />
</client>
You can simply manually add a second endpoint to the config - or use the Wcf Configuration Tool in Visual Studio to do that! - like so:
<client>
<endpoint name="Default"
address="http://localhost:76/XXX/RRR/ManagerService"
binding="basicHttpBinding"
contract="XXX.RRR.Common.ServiceLayer.IMySL" />
<endpoint name="TCP"
address="net.tcp://localhost:86/XXX/RRR/ManagerService"
binding="netTcpBinding"
contract="XXX.RRR.Common.ServiceLayer.IMySL" />
</client>
However, with the current configuration you have on the service side, you only expose a single netTcp endpoint on the server - so you won't even be able to connect to the server using HTTP to create your client proxy.....