Click here to Skip to main content
12,511,553 members (48,327 online)
Rate this:
Please Sign up or sign in to vote.
See more: .NET Silverlight , +
Hi friends,

I'm facing cross domain issue while running the application, error is

System.ServiceModel.CommunicationException: An error occurred while trying to make a request to URI 'hhtp://localhost/Silverlight/Services/abcservice.svc'. This could be due to attempting to access a service in a cross-domain way without a cross-domain policy in the place, or a policy that is unsuitable for soap services.This error may also be created by using internal types in the web service proxy without using the InternalVisibleAttribute attribute. Please see the inner exception. --> blah blah

I searched and found one site [^]that gives solution to the cross domain error sighs!!!!

I done exactly what he says but there is no solution.

I copied a clientaccesspolicy.xml and crossdomain.xml file and placed it in root folder of my project.

But the service(.svc) and its code file (.cs) is placed in my project within a folder named service.

According to the site it says, placing the two xml files in the root folder that has service in it will resolve the issue.
But in my case it does'nt.

what should i do?

Please help me asap!!!!
Any ideas will be greatly appreciated!!!
Posted 17-Sep-12 3:26am
Updated 17-Sep-12 19:30pm
TRK3 17-Sep-12 18:48pm
You need to give us more information if you expect to get some help.

What is the exact error message/code? When/where does it occur?

You say you "copied a clientaccesspolicy.xml and crossdomain.xml file and placed it in root folder of my project"

(a) those files are supposed to go on the root of the server [which probably isn't the same as the "root folder of my project"]

(b) there is no way to tell if what you have in those files is actually what you need to have in those files.
rk_prabakar 18-Sep-12 1:30am
I edited my question.....
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you want to call a web-service then the root of the website must have a crossdomain.xml that contains:

<!DOCTYPE cross-domain-policy SYSTEM "">
<allow-http-request-headers-from domain="*" headers="*"/>

Look at:[^]
rk_prabakar 18-Sep-12 1:45am
Thats what i mentioned already i did copying the crossdomain.xml and clientaccesspolicy.xml in remote folder but nothing works out
Kuthuparakkal 18-Sep-12 1:50am
Not just copying will do :
The article says; "To allow access to an HTTPS service from any Silverlight control hosted over HTTP application, you need to put the "<domain uri=”https://*”"></domain> element inside your <allow-from> element.
rk_prabakar 18-Sep-12 2:00am
I did that too.... i added for http and https as well.
Kuthuparakkal 18-Sep-12 2:16am
updated solution, try now
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Sometimes something turns in to my way.
I did everything that i can, but stuck with that error.
I searched in google for this error, placed clientaccesspolicy.xml in service folder, placed crossdomain.xml in the same.But nothing works for me.

Then only struck, i try to add port number into my service address path in the ServiceReferences.ClientConfig file.
Earlier it was like
<endpoint address="http://localhost/Services/ManualFileUpload.svc">
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ManualFileUpload"
contract="UploadFileService.ManualFileUpload" name="BasicHttpBinding_ManualFileUpload" />
I added port number(4009) to the address like this
<endpoint address="http://localhost:4009/Services/ManualFileUpload.svc">
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ManualFileUpload"
contract="UploadFileService.ManualFileUpload" name="BasicHttpBinding_ManualFileUpload" />
Now it works fine and cool in the application.
And now Crossdomain policy error got resolved.

Thanks friends.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 1 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100