views:

29

answers:

2

I am getting the following exception message when I try to run my newly created Silverlight app:

  • An error occurred while trying to make a request to URI 'http://localhost:8732/Design_Time_Addresses/IsAProgrammer.Service/Service1/'. 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. Please see the inner exception for more details.

This is what I have done. I started with a silverlight app. That created 2 projects. My actual silverlight app and one called MySolutionName.web (not sure what that does except host my silverlight page).

I then made a WCF project so I could have some services for my Silverlight app to consume. I made my services and then added a Service Reference to the silverlight project. I then changed the binding to be basicHttpBinding for my services. (I subsequently refreshed my Service Resource reference in the Silverlight app.)

I reading about this error, I have found that I need a clientaccesspolicy.xml and a CrossDomain.xml file to fix it. I found a generic copy of each of these and added them to both my MySolutionName.Web project and my WCF project.

Any other ideas would be great.

A: 

When u r playing with wcf sevice for the first time with silverlight or wpf these errors are bound to come :). The below link will help you to put your crossdomain policy in right place.

http://stackoverflow.com/questions/2865895/where-to-place-clientaccesspolicy-xml-for-local-wcf-service/2865953#2865953

Malcolm
Ooops, try again with those links. (BTW there is no need to start an answer with the Questioners name and since there is not short text limit whole words are prefered).
AnthonyWJones
+1  A: 

I don't do a lot of WCF myself but it sounds like you've created yourself 2 web applications, one where the Silveright app is host and one service the WCF. Was this intentional?

At a guess I think you should have just added a WCF Service item to the existing host web application.

AnthonyWJones