2008年10月20日月曜日

Silverlight2からADO.NET DataService

Silverlight2からADO.NET DataServiceへ接続しようとしてて気づいた点。
現状(RC0)ではSilverlightからクロスドメインのADO.NET DataServiceへの接続はサポートされないようですね。

既存のDataServiceへ接続しようとすると、ポリシーファイル置いても何してもダメだったけど、
SilverlightをホストしてるWebサイト上にDataServiceを追加したら何も問題なし。

探してたらMSDNフォーラムにこんなのがありました。

(一部引用)
There is no support for accessing cross-domain ADO.NET Data Services using the Silverlight client library in this  release.
The networking stack provided by Silverlight allows you to access cross domain data services. so, if you dont use the DataServiceContext and  instead use HttpWebRequest to access the data service then you will have cross domain access to the data service.
Cross-domain access to ADO.NET Data Services with the Silverlight client library is not allowed in SL2 RC0/RTM bits.

DataServiceContextを使わずにHttpWebRequestでならアクセスできるみたいですが・・・

まあ現状では、DataServiceの配置をSilverlightと同ドメインにするべし。
でもデバッグで開発サーバー使っていると、
別プロジェクトでクロスドメインになっちゃうから面倒くさいですね。。。

0 件のコメント: