I have a silverlight app deployed to appharbor. It works fine on my computer but when other users try to access it, any WCF communication returns on the callback with an Async_Exception. It says the exception is a System.ServiceModel.CommunicationException
[CrossDomain], but my WCF service communicates with files on the same Domain. Plus, it wouldn't make sense if it works on MY computer, right?
Please make sure the clientaccesspolicy.xml file is placed at the root of the domain where the service is hosted.
There is an easy way to check whether a service is set up correctly for cross-domain access. Open a browser and browse to http://service_domain/clientaccesspolicy.xml and then to http://service_domain/crossdomain.xml. If at least one of these is present,
is valid, and is configured to allow cross-domain access, then the service will be accessible from domains other than the domain it is in.
Please take a look at "Check for Cross-Domain Issues" part of a document below.
I already have the clientaccesspolicy: http://duelportal.apphb.com/clientaccesspolicy.xml
I think there's some misunderstanding here. I have this deployed to AppHarbor,
Not my machine. I can access it from
my computer, which if I understand correctly rules out the typical Cross Domain errors that others get. I'm asking what makes my computer so special, why can I access my program which is on AppHarbor, while others
cannot.
Is it a firewall issue? I already tried disabling the Windows firewall on another computer, they still couldn't access the WCF.
Updated main post with Web.Config if it helps.
EDIT: I found out with Fiddler that the request for clientaccesspolicy.xml returns 404 on other computers. BUT it doesn't even request it on mine.
EDIT: I found out with Fiddler that the request for clientaccesspolicy.xml returns 404 on other computers. BUT it doesn't even request it on mine.
Please check the machine if it contains a policy that forbids cross-domain access.
For other computers that cannot access the service, put a breakpoint in where you invoke the service to make sure that the service is actually invoked. And look very carefully at both the request and the reply, including the body and HTTP headers to find
the specifc issue.
Best Regards.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
seattleite7
0 Points
3 Posts
WCF works on dev computer but not on others
Jan 03, 2013 04:39 AM|LINK
I have a silverlight app deployed to appharbor. It works fine on my computer but when other users try to access it, any WCF communication returns on the callback with an Async_Exception. It says the exception is a System.ServiceModel.CommunicationException [CrossDomain], but my WCF service communicates with files on the same Domain. Plus, it wouldn't make sense if it works on MY computer, right?
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" /> </system.web> <system.webServer> <defaultDocument enabled="true"> <files> <add value="DuelPortalOnlineTestPage.html" /> <add value="ClientBin/DuelPortalOnline.xap"/> </files> </defaultDocument> </system.webServer> <system.serviceModel> <services> <service name="DuelPortalOnline.Web.SQL_Webclient_Service"> <endpoint address="" binding="customBinding" bindingConfiguration="DuelPortalOnline.Web.SQL_Webclient_Service.customBinding0" contract="DuelPortalOnline.Web.SQL_Webclient_Service" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> <service name="DuelPortalOnline.Web.SocketService"> <endpoint address="" binding="customBinding" bindingConfiguration="DuelPortalOnline.Web.SocketService.customBinding0" contract="DuelPortalOnline.Web.SocketService" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name=""> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> <bindings> <customBinding> <binding name="DuelPortalOnline.Web.SQL_Webclient_Service.customBinding0" openTimeout="04:00:00" receiveTimeout="04:00:00" sendTimeout="04:00:00"> <binaryMessageEncoding /> <httpTransport /> </binding> <binding name="DuelPortalOnline.Web.SocketService.customBinding0"> <binaryMessageEncoding /> <httpTransport /> </binding> </customBinding> </bindings> <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" /> </system.serviceModel> </configuration>sameer_khanj...
Star
7504 Points
1466 Posts
Re: WCF works on dev computer but not on others
Jan 03, 2013 09:23 AM|LINK
You are accessing WCF from other computers (computer runing on file webserver ) it triting as cross domain, please
check below URL
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/1fa2f718-c6f3-41b0-a663-5e65876472ac
sameer.khanjit@gmail.com
View Blog
Click "Mark as Answer" on the post that helped you.
seattleite7
0 Points
3 Posts
Re: WCF works on dev computer but not on others
Jan 03, 2013 07:58 PM|LINK
I'm hosting it on AppHarbor, not my computer.
And I put in the clientaccesspolicy.xml file -
<?xml version="1.0" encoding ="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from>
<domain uri="*"/>
</allow-from>
<grant-to>
<socket-resource port="4502-4532" protocol="tcp" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Haixia Xie -...
Contributor
3077 Points
297 Posts
Microsoft
Re: WCF works on dev computer but not on others
Jan 04, 2013 08:34 AM|LINK
Hi,
Please make sure the clientaccesspolicy.xml file is placed at the root of the domain where the service is hosted.
There is an easy way to check whether a service is set up correctly for cross-domain access. Open a browser and browse to http://service_domain/clientaccesspolicy.xml and then to http://service_domain/crossdomain.xml. If at least one of these is present, is valid, and is configured to allow cross-domain access, then the service will be accessible from domains other than the domain it is in.
Please take a look at "Check for Cross-Domain Issues" part of a document below.
http://msdn.microsoft.com/en-us/library/cc197938(v=VS.95).aspx
Best Regards.
Feedback to us
Develop and promote your apps in Windows Store
seattleite7
0 Points
3 Posts
Re: WCF works on dev computer but not on others
Jan 04, 2013 08:46 PM|LINK
I already have the clientaccesspolicy: http://duelportal.apphb.com/clientaccesspolicy.xml
I think there's some misunderstanding here. I have this deployed to AppHarbor, Not my machine. I can access it from my computer, which if I understand correctly rules out the typical Cross Domain errors that others get. I'm asking what makes my computer so special, why can I access my program which is on AppHarbor, while others cannot.
Is it a firewall issue? I already tried disabling the Windows firewall on another computer, they still couldn't access the WCF.
Updated main post with Web.Config if it helps.
EDIT: I found out with Fiddler that the request for clientaccesspolicy.xml returns 404 on other computers. BUT it doesn't even request it on mine.
Haixia Xie -...
Contributor
3077 Points
297 Posts
Microsoft
Re: WCF works on dev computer but not on others
Jan 10, 2013 08:41 AM|LINK
Hi,
Please check the machine if it contains a policy that forbids cross-domain access.
For other computers that cannot access the service, put a breakpoint in where you invoke the service to make sure that the service is actually invoked. And look very carefully at both the request and the reply, including the body and HTTP headers to find the specifc issue.
Best Regards.
Feedback to us
Develop and promote your apps in Windows Store