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
Related
I have a WCF Service hosted as a Windows Service in the server.
The endpoint is net.tcp endpoint. We are accessing the endpoints from a Silverlight application.
Problem is when we are trying to access the service from the web app while browsing the Silverlight application using HTTP it works fine. But when we try to do so removing HTTP binding from the Silverlight app from IIS and browse the app using HTTPS the service endpoints are unavailable and gets access permission error from Sockets. I am attaching the error screenshot below:
Could not connect to service. The connection attempt lasted for a time span of 00:00:01.0865926. TCP error code 10061: No connection could be made because the target machine actively refused it. 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.
I created wcf service library with duplex communication and hosting using windows service, and one more project for clinet i.e, inside windows service I added wcf service reference and trying to consume service. when I try to call wcf service callback method I m getting "The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.9390000'".
This error I m getting when I try to consume wcf service from remote system within the network.From same sytem I am able to access the service callback flow.
I tried increasing service timeout and MaxBufferSize, MaxBufferPoolSize, MaxReceivedMessageSize, MaxArrayLength sizes also, but no luck. Icreated sample service and client n uploaded in below link.
Sample Applications link
App1 :- WCFService(winhosting).zip: consists of two pojects one is wcf service library project with callbacks and second project is windows service to hosting wcf service
App2 :- WCFClient(WinService) (2).zip : consists of one project i.e, windows service added wcf service reference here.
I haven't looked at the downloads yet but you sound like you've looked around a good bit so the only thing I can think of is that you run your service as administrator. This was my problem, it would not send the packets and I got the same error as you, all due to the service not running as administrator. Right click your service -> Properties -> Log On -> Make sure you tick "This account" and then type in the administrator credentials and try it :)
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
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).
I have a Windows Service that exposes a WCF service and so I'm not using IIS. I'm suddenly getting the famous SecurityException that mentions using a cross-domain policy when I try to access the service from a Silverlight app. However, since I'm not using IIS, does that mean I need to have a web server on the same port as my WCF service just to serve this file? Is there a better way to do it?
You can add another service with webHttpBinding (REST) that serves out ClientAccessPolicy.xml file. Then in your Windows Service, you can start that endpoint along with the other one so that Silverlight clients can get the cross-domain policy file. You can find more information in below links:
Step By Step - Using Silverlight to Access a WCF Service Hosted In a Console Application
Self hosted WCF service and enabling cross domain calls