Skip to main content

Cross-domain access error when starting up Sharepoint app

Author by Concurrency Blog


I recently ran into an issue with a Sharepoint app, powered by Silverlight, that was having an issue with the cross-domain policy on one of our Sharepoint sites. I opened the project in Visual Studio, checked my connection strings, and ran the project in Debug. Before the app could be fully loaded, an unhandled exception occurred:

"An error occurred while trying to make a request to URI '[your URI here]'. 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." 



Having not worked on this project before, I wasn't sure what the issue was. After researching the error I found that the usual cause is a missing or invalid clientacesspolicy.xml and/or crossdomain.xml file. The resource stated putting these files in the root folder of the website would resolve the issue. Unfortunately, I had these files in the root directory already, and they seemed to be valid based on the thread I was reading.

I kept researching for other ideas. I came across this MSDN blog post, which states that for some people the exception will not be thrown if you are running Fiddler while the application is loading. Out of curiosity, I started Fiddler and then restarted the app. I did get the same error, but Fiddler gave me a hint: a 404 was returned when my application tried to access the clientaccesspolicy.xml file. An additional 404 was returned for the crossdomain.xml file. When I tried to access those files through IE, I did get a 404 - and interestingly, it wasn't an IIS 404, it was a IE-generated HTTP 404 Not Found page. That threw logging out the window as possible assistance.


The Solution

I found that the solution was to recycle the app pool for my site on the app/dev server and, in my case, the web front-end server as well. That allowed me to browse to the XML file(s) on the app/dev server, and fixed the error with finding those XML files. Fiddler can be an amazing thing. Hope this fix helps others!


Concurrency Blog

The latest about Concurrency