Monday, July 7, 2008

ProtocolException 404 Silverlight WCF

This is blog entry will help those who understand Cross Domain restrictions in Silverlight while calling a WCF service in another domain. If you already tried many prescribed things to allow Cross Domain Access like placing the clientaccesspolicy.xml in wwwroot folder and putting a crossdomain.xml on the IIS root (wwwroot folder). But still you are getting the same obstinate 404 error. Then you can try these two tricks which worked for me

1. Firstly make sure the you restart IIS whenever you create new policy files or update them.

2. Make sure that you SL client is an aspx page not HTML page (because aspx page runs in worker process account, somehow html doesn't work for some people)

3. Try changing this line in your clientaccesspolicy.xml

From :

<allow-from>
<domain uri="*"/>
</allow-from>

To:

<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>

These tricks worked for me and I wish they work for you also :)

No comments: