Saturday, April 23, 2011

silverlight exception

when i was trying to get the data from a webservice in my silverlight project i got the following exception. It was working few minutes back but when i restarted my visual studio project i got the exception.
An error occurred while trying to make a request to URI 'http://localhost:1285/WebServices/LoginService.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. Please see the inner exception for more details.

solution: I tried adding the clientaccesspolicy.xml file which is used to access webservice if it is hosted on some other server. but still the same problem. then  I noticed that the random port VS2010 was using earlier had changed from what it was using now(as i restarted my visual studio).  I looked at my service references and it was using the old port number in the service definitions.  I updated the new visual studio port number or you can also delete the service references and then recreate them and everything will work fine - I then checked the web.config and service refs and they now have the new port number.

No comments:

Post a Comment