开发者

Cross Domain Access Policy not working for silverlight hosted in IIS

My silverlight application is currently hosted in IIS and is set up to only use HTTPS.

the silverlight web project is the root of the IIS website and the webservices project开发者_如何转开发 is a seperate web application mapped to /Services.

I can navigate to my site by using "" and ""

but if I use the second option the site loads fine but I get an error when attempting to access any of my services.

An error occurred while trying to make a request to URI 'https://localhost/Services/Services/Authentication.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. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute

I have Crossdomain.xml and clientaccesspolicy.xml files in the root of my Web Services application and also within the root of the Silverlight Web project.

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="https://*" secure="true" />
  <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

clientaccesspolicy.xml

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
      <policy>
  <allow-from>
    <domain uri="https://*"/>
  </allow-from>
  <grant-to>
    <resource path="/" include-subpaths="true"/>
  </grant-to>
</policy>

I'm not really sure what the problem is.

Thanks

Edit

The following is the what fiddler shows after calling the service. .

Cross Domain Access Policy not working for silverlight hosted in IIS

With fiddler set up to decode https IE didn't show any extra entries, but with chrome I get the following output

Cross Domain Access Policy not working for silverlight hosted in IIS


As the error message says, "This could be due to attempting to access a service in a cross-domain way..." Try using some tool such as Fiddler in the client to see what is the actual response from the server. That will give you more information about the issue.


As shown by fiddler your reference file for the service are having pointers to localhost:444 this usually happens when you have both projects in same solution and add the service reference.


I resolved this by right clicking on the frontEnd.Web part of my solution, going to properties and then the Web tab, instead of using an auto assign port option, I changed it to use local IIS server. This got rid of the error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜