I currently have a WCF Service with a CallBack Contract (duplex), and when I use the application that makes use of it on my computer everything works fine, but when I try it from a different computer, it doesn't connect.
These problems started occurring once I switched to using this wsDualHttpBinding (for callbacks) because when I used wsHttpBinding everything worked fine.
Why is the web service not accepting requests from other computers? Is it some hosting settings that need to be modified?
As regards the logs, I am getting these:
alt text http://img17.imageshack.us/img17/4628/wcfissue.jpg
The open operation did not complete
within the allotted timeout of
00:01:00. The time allotted to this
operation may have been a portion of a
longer timeout
Failed to open System.ServiceModel.Channels.ClientReliableDuplexSessionChannel
Faulted
System.ServiceModel.Channels.ClientReliableDuplexSessionChannel
Faulted
System.ServiceModel.Channels.ServiceChannel
Failed to open
System.ServiceModel.Channels.ServiceChannel
The port is open on my router (both TCP and UDP) so that is not the issue.
As regards the Service Attributes, this is what I'm using:
Interface:
[ServiceContract(Name = "MusicRepo_DBAccess_Service",
CallbackContract = typeof(IOnlineUsersCallback),
SessionMode=SessionMode.Required)]
Service:
[ServiceBehavior(
ConcurrencyMode=ConcurrencyMode.Reentrant,
InstanceContextMode=InstanceContextMode.Single)]
[Update]
As regards Orion Edwards' post:
No Firewall
See point 1
Yes I can, because I have the port forwarded on my router
I'm using IIS to host the server.
The thing is, this problem started happening when I switched from wsHttpBinding (which was working fine) to wsDualHttpBinding (because I needed callbacks)
[Update]
I have now switched from wsDualHttpBinding to NetTcpBinding and for some reason, everything is working fine.
I have used this article to help me set up hosting on IIS, and thankully everything is working as expected, with callbacks.
I have now switched from wsDualHttpBinding to NetTcpBinding and for some reason, everything is working fine.
I have used this article to help me set up hosting on IIS, and thankully everything is working as expected, with callbacks.
It would help if you posted the server and client configuration settings.
Here's a summary of how the wsDualHttpBinding works from MSDN (emphasise mine):
The WSDualHttpBinding provides the
same support for Web Service protocols
as the WSHttpBinding, but for use with
duplex contracts. WSDualHttpBinding
only supports SOAP security and
requires reliable messaging. This
binding requires that the client has a
public URI that provides a callback
endpoint for the service. This is
provided by the clientBaseAddress
attribute. A dual binding exposes the
IP address of the client to the
service. The client should use
security to ensure that it only
connects to services it trusts.
This binding can be used to
communicate reliably through one or
more SOAP intermediaries.
By default, this binding generates a
runtime stack with
WS-ReliableMessaging for reliability,
WS-Security for message security and
authentication, HTTP for message
delivery, and a Text/XML message
encoding.
Things to check:
Windows Firewall
Your antivirus product's firewall
Can you telnet into the port from a remote machine?
Is your "server" running under the ASP.NET development server? That will only accept requests from localhosts - you need to self-host the server using ServiceHost or host it under IIS.
Related
I've wrote a web application that is also listening to a net tcp port.
the client of this web application is connecting via a plain tcp connection and everything is working great but the issue is that the IIS is stopping my site after some inactive time.
The issue is that the web application is initializing the tcp connection and any new connection is coming directly to the TCP connection without being hosted by the site.
I'm not sure how this should be solved.
found exactly the post that nailed it!
https://weblog.west-wind.com/posts/2013/oct/02/use-iis-application-initialization-for-keeping-aspnet-apps-alive
in general it specify that the application pool should be set to always running and the site should host the service at the pre load event that should be configured and implemented.
I have a WCF service which works fine when accessed internally. The WCF link is
.
I requested the network team at our organization to expose this WCF to outside world since public websites will access this WCF. I gave the network team DNS as somewebsite.com and IP address of the server on which WCF is hosted.
After getting the confirmation from Network team (they use Juniper network ) that they have made the required settings to make the WCF available to outside world I tested it as an external user.
If I type in http://somewebsite.com/LookUp.svc on address bar I get http 404 page not found error. However if I replace http with httpS as then I see the WCF information. To further test it , I added a simple html file to the root of the website and opened as
http://somewebsite.com/test.html. The Test.html does not open when http is used. However it I use httpS as then Test.html page is displayed to outside users.
The WCF is hosted to windows 2008 R2 and is communicating over port 80 and I have also added the site binding as somewebsite.com with Type as Http and port as 80.
Any idea why WCF caanot be accseed over http ?. I want it to be accessed over http only ?. The WCF uses basicHttpBinding
Is the setting wrong on server on which WCF is hosted ?
Any suggestion is greatly appreciated..
If the service worked before over http before your network guys opened the firewalls I would suggest that they have only enabled the firewall for https traffic.
Sounds like a firewall/routing problem to me...
HTH
We have a windows application and it consumes WCF sevice and we use Network Load balancing.Sometimes clients could not connect to wcf service(server).
we use NetTcpBinding binding. Can anyone give me an idea to solve this issue.
Can you post your bindings here?
I would turn on tracing in your web service config to check that traffic is indeed reaching all your intended endpoints. NetTcpBinding pools TCP connections by default, so it could be that the client connection has associated itself to a specific server which is now not available. This would then mean that connections would start to fail. It is recommended that you tweak the default binding settings for NetTcpBinding when used in a load balanced scenario to reduce the lease timeout so that requests are load balanced better. http://msdn.microsoft.com/en-us/library/ms730128.aspx
I have a learning application that implements the most important endpoints in a sole service. I am implementing net.tcp + wsHttp + BasicHttp and WebHttp, They all work great except for net.tcp. When i access it through the browser it tells me the following:
The protocol 'net.tcp' is not supported.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The protocol 'net.tcp' is not supported.
Seems like a fairly common problem as I researched through the internet and concluded that because I was on xp using it locally I can't. And when I do the request I get a Socketexception with connection refused code.
But then again I made another project with only net.tcp and its endpoints and bindings and it works! So it most likely means I am not using IIS. I'm still a beginner in wcf, it tells me it is hosted by WCF Service host.
Can someone explain to me what can I do to make it work on windows xp?
Thanks
Yes, you are correct - Net.TCP is not available on IIS 5.1 (Windows XP).
To use Net.TCP on an XP machine you have two hosting options:
Self-hosted service (you write the program that hosts the service, using ServiceHost
Windows Service hosted - your service is hosted in a Windows Service.
IIS - HTTP only.
Refer to Hosting Services for an overview and comparison of the various methods to host a WCF service.
Browsers (and therefore IIS serving them) use HTTP.
TCP is a lower level protocol that would require a custom client to communicate with (such as a Windows App). The WCF Service host is an utility that can host your service for you whilst debugging. Normally you would write a proper host (exe or Windows service).
In my project I have one WCF Service which is hosted in a Windows Service. I hosted the WCF Service in Windows Service over netTCPBinding and Installed Windows Service. To access WCF service in my silverlight project I have added service reference of wcf.
But, when I am calling a method in WCF Service am getting the following error :
Could not connect to
net.tcp://localhost:8732/WCFHost/.
The connection attempt lasted for a time
span of 00:00:03.2951885.
TCP error code 10013: An attempt was made to
access a socket in a way forbidden by
its access permissions..
This could be
due to attempting to access a service
in a cross-domain way while the
service is not configured for
cross-domain access. You may need to
contact the owner of the service to
expose a sockets cross-domain policy
over HTTP and host the service in the
allowed sockets port range 4502-4534.
Please help me out.
For same-machine connections rather make use of Named Pipe bindings.
It might help if you showed us your service and client side endpoint configurations.
EDIT: After reading up a bit on the error you're getting (here among other sites), try changing the port number from 8732 to something between 4502-4534 as the error message suggests.
Keep same protocols at both the server and client end. May be your are calling the service with different protocols. Also check if your are using nettcp, your are having access to the machine where service is hosted.
use basicHttpBinding instead of netTCPBinding