Thursday, September 30, 2010
Silverlight & Fiddler; cross domain issues
Can't get fiddler to listen to any of the traffic on the new app you are building? It's because Fiddler doesn't listen to traffic on the localhost by default. Fiddler recommends using ipv4.fiddler in place of localhost to capture localhost messages. To do this with a silverlight service you'd modify your Silverlight apps ServiceReferences.ClientConfig file to something such as the following.
Or by using the new Silverlight 4.0 relative address feature.
Yet this crops up a new cross domain issue when running the application. This is because ipv4.fiddler is considered a different domain than localhost. The fix is fairly easy, get rid of localhost in the URL you use to request the local app:
http://ipv4.fiddler:2119/SilverlightTestPage.aspx
Reference:
starts 18:25 minutes into http://channel9.msdn.com/Shows/SilverlightTV/Silverlight-TV-46-Whats-Wrong-with-my-WCF-Service
http://blogs.msdn.com/b/silverlightws/archive/2010/05/10/fiddler-inspector-for-wcf-silverlight-polling-duplex-and-wcf-ria.aspx
<endpoint address="http://ipv4.fiddler:2119/WCFservice.svc" binding="customBinding" bindingConfiguration="CustomBinding_WCFservice" contract="WCFServiceReference.WCFservice" name="CustomBinding_WCFservice" />
</client>
</system.serviceModel>
Or by using the new Silverlight 4.0 relative address feature.
<endpoint address="../WCFservice.svc" binding="customBinding" bindingConfiguration="CustomBinding_WCFservice" contract="WCFServiceReference.WCFservice" name="CustomBinding_WCFservice" />
</client>
</system.serviceModel>
Yet this crops up a new cross domain issue when running the application. This is because ipv4.fiddler is considered a different domain than localhost. The fix is fairly easy, get rid of localhost in the URL you use to request the local app:
http://ipv4.fiddler:2119/SilverlightTestPage.aspx
Reference:
starts 18:25 minutes into http://channel9.msdn.com/Shows/SilverlightTV/Silverlight-TV-46-Whats-Wrong-with-my-WCF-Service
http://blogs.msdn.com/b/silverlightws/archive/2010/05/10/fiddler-inspector-for-wcf-silverlight-polling-duplex-and-wcf-ria.aspx
Labels: cross-domain, Fiddler, Silverlight
Subscribe to Posts [Atom]