2011-08-12 14 views
1

これは、Silverlightアプリケーションで、wcfサービスに接続し、別のwcfサービスに接続します。一部のクライアントからアクセスしたときにwcfがエラーになる

このアプリケーション全体は、Windows 2003サーバー(wcfサービスとSilverlightアプリケーションの両方)にあります。それは銀色なので、ブラウザ上で動作します。私たちは多くの開発マシンのうち2つからアクセス/実行できます。これらの2台のマシンからは正常に動作しますが、他のマシンや同じサーバー内からは正常に動作しません。

これは、次のエラーがスローされます。

[Async_ExceptionOccurred] Arguments: Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60310.0&File=System.dll&Key=Async_ExceptionOccurred

at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at SilverlightClient.TestWCFReference.sendRequestCompletedEventArgs.get_Result() at SilverlightClient.Views.TestFormControl.sendRequestCompleted(Object sender, sendRequestCompletedEventArgs e) at SilverlightClient.TestWCFReference.Service1Client.OnsendRequestCompleted(Object state)

+0

これはクライアントでの例外のようですが、実際に何が起こったかはわかりません。ログなどに書き込むと仮定して、サーバーのエラーをチェックする必要があります。 – CodingWithSpike

+0

それら2台のマシンで動作する理由は、それらのマシンにすでに同じwcfサービスがインストールされているからです。サーバー – gangt

+0

のローカルwcfではなく、ローカルwcfを取得していたので、基本的に、Silverlightアプリケーションはwcfサービスにアクセスできませんでした。無駄な人を試してみてください。 – gangt

答えて

1

私は、Silverlightクライアントがの.xapからclientconfigファイルではなく、外部のいずれかを使用して、問題を発見しました。私はプロジェクトからclientconfigを削除しなければならなかった。

EndPoint設定では、Silverlight Webプロジェクトのweb.configに手動で設定を追加し、.jsファイルに渡してApp.configから読み取りました。できます。

のweb.config

<appSettings> 
    <add key="serviceurl" value="http://localhost/Service/Service.svc"/> 
    </appSettings> 

default.aspx.cs

protected void Page_Load(object sender, EventArgs e) 
{ 
    InitialParams = "serviceurl=" + System.Configuration.ConfigurationManager.AppSettings["ServiceURL"]; 
} 

Default.aspxの

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"> 
<!--other params go here--> 
       <param name="initParams" value="<%= InitialParams%>" /> 
</object> 

App.xaml.cs

//field 
public static string ServiceURL = ""; 

private void Application_Startup(object sender, StartupEventArgs e) 
{ 
    ServiceURL = e.InitParams["serviceurl"]; 
     this.RootVisual = new MainPage(); 
} 

MainPage.Xaml.cs

string url = App.ServiceURL; 
関連する問題