2011-01-04 13 views
1

Silverlightを初めて使用している場合は、SilverlightでSilverlightと同じように呼び出す手順がASPであるかどうかを知りたかったのですが、違いがあります。違いがある場合は、 。Silverlightの呼び出しWCF

ありがとうございます。あなたが気づい必要

答えて

1

主なものはあり

    のみ
  1. はあなたが、その後、WCFのホストサーバーのルートフォルダにclientaccesspolicy.xmlファイルまたはcrossdomain.xmlのいずれかを持っているだけですbasichttpbinding
  2. Silverlightのサポート成功した私は答えを得た

    http://msdn.microsoft.com/en-us/library/cc197955%28v=vs.95%29.aspx

silerlight

1

からWebサービスを呼び出すことができ、わずかにありaspとsilverlightの違い。 Silverlightでは、すべてのサービス呼び出しは非同期であるため、非同期呼び出しが完了した時点でデータを取得するためのイベントハンドラが必要です。あなたは、ASPからあなたのWCFサービスを呼び出すと

ほんの少し例えば

、あなたがシルバーの場合は

proxy_http.FunctionClient fc = new proxy_http.FunctionClient(); 
     txtDisplay.Text = fc.Add(Convert.ToInt32(txtFirst.Text),Convert.ToInt32(txtSecond.Text)).ToString(); 

を使用し、あなたが使用する必要がありますも

private void Add_Click(object sender, RoutedEventArgs e) 
    { 
     proxy_htt.FunctionClient fc = new proxy_htt.FunctionClient(); 
     fc.AddCompleted += new EventHandler<proxy_htt.AddCompletedEventArgs>(fc_AddCompleted); 
     fc.AddAsync(Convert.ToInt32(txtFirst.Text),Convert.ToInt32(txtSecond.Text)); 

    } 

    void fc_AddCompleted(object sender, proxy_htt.AddCompletedEventArgs e) 
    { 
     txtResult.Text = e.Result.ToString(); 
    } 
+2

を使用します。 clientaccesspolicy.xmlファイルまたはcrossdomain.xmlのいずれか – Everest

関連する問題