wcf web service cross domain woes
Steve Richter <[email protected]>
| Newsgroups | gmane.comp.windows.off-topic |
|---|---|
| Message-ID | <[email protected]> |
I am getting an "attempting to access a service in a cross domain way"
error when calling a simple WCF web service from a silverlight3 app. I
dealt with the cross domain error I got after publishing the WCF web
service project to my web server. I added the ClientAccessPolicy.xml
file to the wwwroot directory of the web server. Now I want to debug
another error, so I have added a silverlight3 project to the WCF web
service project. The theory being I will be able to use breakpoints to
debug both the client and server side of the code. But my 'cross
domain" error has returned when I call the web service on localhost.
Any ideas?
thanks,
An error occurred while trying to make a request to URI
'http://localhost:56605/DocService.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.
a simplified web service method returns a string:
[ServiceContract]
public interface IDocService
{
[OperationContract]
string GetDocName2( string InDocName );
}
public string GetDocName2(string InDocName)
{
return InDocName;
}
web.config has binding="basicHttpBinding"
<service behaviorConfiguration="DocImageWebService.DocServiceBehavior"
name="DocImageWebService.DocService">
<endpoint address="" binding="basicHttpBinding"
contract="DocImageWebService.IDocService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
silverlight code calls the web service:
DocServiceClient proxy = new DocServiceClient();
proxy.GetDocName2Completed +=
new EventHandler<GetDocName2CompletedEventArgs>(proxy_GetDocName2Completed);
proxy.GetDocName2Async("IRS_1");