I have created a silverlight control and linked it to an aspx page.Silverlight internally has WCF service reference and calls WCF exposed methods to populate the data.
I have hosted my application in IIS.When i am browsing the application with server name (say:http:\\servername:port\\silverlightpage.aspx) ,the control is getting rendered properly.
But when i acces the application with the server ip address, it throws an cross domain issue(i.e:http:\\999.99.99.999:8080\\silverlightpage.aspx) .The silverlight controls throws an exception for crossdomain
does your SL application calls a WCF service or an asmx one?
If it consumes WCF, please control the <endpoint> section of the web.config configuration file, it should contain something like this (the address option should be set to ""):
Also verify that crossdomain.xml/clientaccesspolicy.xml are in the right place (c:\inetpub\wwwroot - but they should be already there, the app correctly runs, right?).
Is your WCF service test-page shown correctly in
Internet Explorer inserting the address http://<yourServerIP>:<yourServerPort>/PatientCareService.svc?
An error occurred while trying to make a request to URI 'http://999.99.99.99:7000/PatientCareService.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable
for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details.
thanks
Prasad Bhalekar (PP)
Please "Mark as Answer" if any of my content helped resolve the issue
This will cause the cross-domain visit. We need to add the policy file to
your Service.
Would you please check whether your policy file is at your website's root? If you host your service on IIS, please make sure it is also in the root.
Best regards,
Jonathan
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
Prasad Bhalekar
Member
170 Points
39 Posts
Silverlight WCF crossdomain Issue
Nov 24, 2008 07:30 PM | LINK
I have created a silverlight control and linked it to an aspx page.Silverlight internally has WCF service reference and calls WCF exposed methods to populate the data.
I have hosted my application in IIS.When i am browsing the application with server name (say:http:\\servername:port\\silverlightpage.aspx) ,the control is getting rendered properly.
But when i acces the application with the server ip address, it throws an cross domain issue(i.e:http:\\999.99.99.999:8080\\silverlightpage.aspx) .The silverlight controls throws an exception for crossdomain
Here is my crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
and
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from>
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Prasad Bhalekar (PP)
Please "Mark as Answer" if any of my content helped resolve the issue
davidezordan
Contributor
6294 Points
957 Posts
Re: Silverlight WCF crossdomain Issue
Nov 24, 2008 07:38 PM | LINK
Hi,
this is a correct crossdomain.xml file:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
and clientaccesspolicy.xml:
<?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"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Hope this helps,
Silverlight MVP
Blog Twitter Silverlight Experts
Prasad Bhalekar
Member
170 Points
39 Posts
Re: Re: Silverlight WCF crossdomain Issue
Nov 24, 2008 08:02 PM | LINK
hi Davide
Still i am getting same error message
can you help me for same
Prasad Bhalekar (PP)
Please "Mark as Answer" if any of my content helped resolve the issue
davidezordan
Contributor
6294 Points
957 Posts
Re: Re: Re: Silverlight WCF crossdomain Issue
Nov 24, 2008 08:37 PM | LINK
Hi Prasad,
does your SL application calls a WCF service or an asmx one?
If it consumes WCF, please control the <endpoint> section of the web.config configuration file, it should contain something like this (the address option should be set to ""):
<
endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" contract="Service1ns.IService1" name="BasicHttpBinding_IService1" />Also verify that crossdomain.xml/clientaccesspolicy.xml are in the right place (c:\inetpub\wwwroot - but they should be already there, the app correctly runs, right?).
Silverlight MVP
Blog Twitter Silverlight Experts
Prasad Bhalekar
Member
170 Points
39 Posts
Re: Re: Re: Re: Silverlight WCF crossdomain Issue
Nov 24, 2008 08:53 PM | LINK
here is my
ServiceReferences.ClientConfig
<configuration><
system.serviceModel> <bindings> <basicHttpBinding><
binding name="MyService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"><
security mode="None" /> </binding></
basicHttpBinding> </bindings> <client><
endpoint address=http://servername:7000/MyService.svc binding="basicHttpBinding" bindingConfiguration="MyService" contract="MyService.IMyService" name="MyService" /></
client> </system.serviceModel></
configuration>Prasad Bhalekar (PP)
Please "Mark as Answer" if any of my content helped resolve the issue
davidezordan
Contributor
6294 Points
957 Posts
Re: Re: Re: Re: Re: Silverlight WCF crossdomain Issue
Nov 24, 2008 09:31 PM | LINK
Try to add this endpoint to your ServiceReferences.ClientConfig:
<endpoint address="http://<yourServerIP>:<yourServerPort>/PatientCareService.svc"
binding="basicHttpBinding" bindingConfiguration="PatientCareService" contract="PatientCareService.IPatientCareService" name="PatientCareService" />Is your WCF service test-page shown correctly in Internet Explorer inserting the address http://<yourServerIP>:<yourServerPort>/PatientCareService.svc?
Silverlight MVP
Blog Twitter Silverlight Experts
Prasad Bhalekar
Member
170 Points
39 Posts
Re: Re: Re: Re: Re: Re: Silverlight WCF crossdomain Issue
Nov 25, 2008 02:53 PM | LINK
After changing all above modification
when i am refering .axpx page by url its working properly
eg. http://<MyServer>/MyWebsite.Web/Myaspx.aspx
i am getting same error
when I refer url of .aspx page using Ip adreees
eg. http://<MyServerIP>/MyWebsite.Web/Myaspx.aspx
error :
An error occurred while trying to make a request to URI 'http://999.99.99.99:7000/PatientCareService.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details.
Prasad Bhalekar (PP)
Please "Mark as Answer" if any of my content helped resolve the issue
davidezordan
Contributor
6294 Points
957 Posts
Re: Re: Re: Re: Re: Re: Re: Silverlight WCF crossdomain Issue
Nov 25, 2008 10:22 PM | LINK
Hi Prasad,
can you post the content of the service web.config file?
Silverlight MVP
Blog Twitter Silverlight Experts
skygragon
Member
16 Points
19 Posts
Re: Re: Re: Re: Re: Re: Silverlight WCF crossdomain Issue
Nov 26, 2008 05:37 AM | LINK
hi~does it matter here to use service ip instead of name?
Jonathan She...
All-Star
50156 Points
4951 Posts
Microsoft
Re: Re: Re: Re: Re: Re: Silverlight WCF crossdomain Issue
Nov 28, 2008 08:16 AM | LINK
Hi Prasad,
http://193.71.24.21:7000/...
http://url:7000/...
This will cause the cross-domain visit. We need to add the policy file to your Service.
Would you please check whether your policy file is at your website's root? If you host your service on IIS, please make sure it is also in the root.
Best regards,
Jonathan
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework