2010年10月23日土曜日

ServiceReferences.ClientConfigの配布

ServiceReferences.ClientConfigはxapファイルに格納されるので、
VisualStudioでのデバッグ環境と、配布する環境とでは記述を変える必要がある。

具体的には、
WCFクライアント設定のエンドポイントのアドレスを変えなければいけないのだが、、、
いちいちVisualStudioでサービス参照を書き換えるのは非常に面倒。

対策は簡単で、
ServiceReferences.ClientConfigを書き換えてビルドし直すだけで、
xapファイルに変更が反映される。

なので、以下のようにそれぞれの環境の設定をコメントアウトして残しておくと楽。

  1. <client>  
  2.   <!--  
  3.   <endpoint address="http://localhost:1335/HogeService.svc" binding="customBinding" bindingConfiguration="CustomBinding_HogeService"  
  4.  contract="HogeService.HogeService" name="CustomBinding_HogeService" />  
  5.   -->  
  6.   <endpoint address="http://hoge.local/HogeService/HogeService.svc" binding="customBinding"  
  7.  bindingConfiguration="CustomBinding_HogeService" contract="HogeService.HogeService" name="CustomBinding_HogeService" />  
  8. </client>  

0 件のコメント:

コメントを投稿