none
Need help with Silverlight 5 and WCF net.tcp binding

    Question

  • Hi,

    I created a WCF and a Silverlight 5 application.

    Also I got net.tcp(with binding information 4502:*) enabled for my subdomain and have copied the clientaccesspolicy.xml file to the wwwroot folder of my subdomain inside which my WCF service resides.

    The clientaccesspolicy.xml looks like the following:

    <?xml version="1.0" encoding="utf-8"?>
    <access-policy>
    <cross-domain-access>
    <policy>
    <allow-from http-request-headers="*">
    <domain uri="*"/>
    </allow-from>
    <grant-to>
    <resource path="/" include-subpaths="true"/>
    <socket-resource port="4502" protocol="tcp"/>
    </grant-to>
    </policy>
    </cross-domain-access>
    </access-policy>

    I am getting the following error:
    Could not connect to *****. The connection attempt lasted for a time span of 00:00:00.0990056. 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.

    Tuesday, April 24, 2012 2:45 PM

Answers

  • Hi,

    I bought a VPS hosting plan for a month using 50% discount coupon(for just 22$ including a new domain) :) just to get admin access on the server. I deployed my service on the server and was getting the same error message. While browsing through blog posts online I came across the firewall thing and thought of making some changes to it.

    Finally solved the problem. It's related to the firewall on the server side. I deployed the WCF service on the server and ran the client application(Silverlight 5) on my machine, my antivirus and windows firewall did not stop it to communicate over port 4502. I am not sure if the firewall on the client side could create a problem(will be testing this in the next few days).

    Solution:

    1. On the server go to Control Panel --> Windows Firewall --> Change Settings --> Exceptions --> Add Port(Add a port such as 4502).

    2. Also you need clientaccesspolicy.xml file in C:\inetpub\wwwroot or C:\inetpub\vhosts\default\htdocs directory on the server.

    I cannot provide you with a working link to my service since I am still testing it and have plans to change my web hosting provider.

    I think Polling is a non expensive solution but in my case it was creating a lot of trouble since I am planning to use the service for WPF and Silverlight along with session management(which is not easy using Polling for applications like chat).

    Thanks,

    Arshdeep

    Saturday, April 28, 2012 9:22 PM
  • Hi,

    Thanks for the reply, I have already solved the issue.

    The crossdomainpolicy.xml and clientaccesspolicy.xml will not help. The windows firewall on the server blocks the communication on the port 4502 or whichever your decide to use.

    I just add an exception in the windows firewall for the port 4502 and it worked.

    Here is the working application(Silverlight 5 using NET.TCP):

    http://iconnect.arshdeep-virdi.com/web/

    Thanks,

    Arshdeep

    Tuesday, May 22, 2012 10:40 PM

All replies

  • Hey, I am having this same problem. So I would also appreciate any responses you receive. 

    However, I was able to get an application working at one point but only from my local machine. When i tried acccessing the client (which consumes the service) from other machines in my LAN, I was seeing the client application but not the output from the service. 

    I have tried following this article, http://tomasz.janczuk.org/2009/11/pubsub-sample-with-wcf-nettcp-protocol.html and how I have the same problem which you are desribing.

    Tuesday, April 24, 2012 6:38 PM
  • Hi,

    I bought a VPS hosting plan for a month using 50% discount coupon(for just 22$ including a new domain) :) just to get admin access on the server. I deployed my service on the server and was getting the same error message. While browsing through blog posts online I came across the firewall thing and thought of making some changes to it.

    Finally solved the problem. It's related to the firewall on the server side. I deployed the WCF service on the server and ran the client application(Silverlight 5) on my machine, my antivirus and windows firewall did not stop it to communicate over port 4502. I am not sure if the firewall on the client side could create a problem(will be testing this in the next few days).

    Solution:

    1. On the server go to Control Panel --> Windows Firewall --> Change Settings --> Exceptions --> Add Port(Add a port such as 4502).

    2. Also you need clientaccesspolicy.xml file in C:\inetpub\wwwroot or C:\inetpub\vhosts\default\htdocs directory on the server.

    I cannot provide you with a working link to my service since I am still testing it and have plans to change my web hosting provider.

    I think Polling is a non expensive solution but in my case it was creating a lot of trouble since I am planning to use the service for WPF and Silverlight along with session management(which is not easy using Polling for applications like chat).

    Thanks,

    Arshdeep

    Saturday, April 28, 2012 9:22 PM
  • Hey,

    I finally got mines working as well. My problem was actually in the client config files which visual studio auto-generates. Once I changed the IP address in the autogenerated file, everything worked perfectly.

    Sunday, April 29, 2012 4:24 PM
  • Hi All,

    You can check my Silverlight 5 Chat Appliaction(partially complete) at:

    http://iconnect.arshdeep-virdi.com/web

    This application is using net.tcp protocol to connect to the WCF service. Also you can download the fully functional WPF client for testing.

    Thanks,

    Arshdeep

    Tuesday, May 22, 2012 5:11 PM
  • Hi All,

    You can check my WPF and Silverlight 5 Chat Appliaction(partially complete) at:

    http://iconnect.arshdeep-virdi.com/web

    This application is using NET.TCP binding to connect to the WCF service. Also you can download the fully functional WPF client for testing.

    Thanks,
    Arshdeep

    Tuesday, May 22, 2012 5:59 PM
  • Hi,

    Thanks for the reply, I have already solved the issue.

    The crossdomainpolicy.xml and clientaccesspolicy.xml will not help. The windows firewall on the server blocks the communication on the port 4502 or whichever your decide to use.

    I just add an exception in the windows firewall for the port 4502 and it worked.

    Here is the working application(Silverlight 5 using NET.TCP):

    http://iconnect.arshdeep-virdi.com/web/

    Thanks,

    Arshdeep

    Tuesday, May 22, 2012 10:40 PM
  • How can i get a login password and activation code to your project so that i can see the solving problem 

    thanks

    Friday, May 25, 2012 10:36 PM
  • u must host ur service in iis7 or windows services and open ur vs with admin permision.

    step2:-check ur web.config and .clientconfig.is it configure correct.

    other wise send ur web.config and clientconfig file

    Hi,

    I created a WCF and a Silverlight 5 application.

    Also I got net.tcp(with binding information 4502:*) enabled for my subdomain and have copied the clientaccesspolicy.xml file to the wwwroot folder of my subdomain inside which my WCF service resides.

    The end point address I used for the WCF Service is:
    net.tcp://iconnect.arsh-virdi.com:4502/Service1.svc

    The clientaccesspolicy.xml looks like the following:

    <?xml version="1.0" encoding="utf-8"?>
    <access-policy>
    <cross-domain-access>
    <policy>
    <allow-from http-request-headers="*">
    <domain uri="*"/>
    </allow-from>
    <grant-to>
    <resource path="/" include-subpaths="true"/>
    <socket-resource port="4502" protocol="tcp"/>
    </grant-to>
    </policy>
    </cross-domain-access>
    </access-policy>

    WCF Service: http://iconnect.arsh-virdi.com/Service1.svc
    Silverlight 5 Client: http://iconnect.arsh-virdi.com/client/SLA2TestPage.aspx

    I am getting the following error:
    Could not connect to net.tcp://iconnect.arsh-virdi.com:4502/Service1.svc. The connection attempt lasted for a time span of 00:00:00.0990056. 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.

    Saturday, June 02, 2012 2:09 AM
  • Hi Shohel,

    You just need to REGISTER with a valid email address and you will get the activation code in your email. Use that activation code to activate your account. I checked my database, you yahoo email address is there in the databse. Also I have resent the activation code to you.

    If you have already created an account but it is still not active, login with your username and password and then activate it.

    Also you can create multiple accounts on the same email.

    Here is the Silverlight 5 version(Make sure your antivirus doesn't block the connection):

    http://iconnect.arshdeep-virdi.com/web/

    Thanks,

    Arshdeep

    Thursday, June 07, 2012 7:24 PM