2010-12-06 6 views
0

ローカルネットワーク上の2台のマシン間でEchoサンプルを実行しようとしています。このサンプルではnetTcpRelayBindingを使用しています。同じマシン上でサービスとクライアントの両方を実行すると正常に動作します。 私が最初にサービスをコンパイルし、それを私の他のマシンに置いたとき、開発ツールをインストールしていないWindows 2003 Server。それはnetTcpRelayBindingがapp.configにあったかどうかわからなかったので実行されませんでした。だから私は設定をコードに移動し、サービスが開始されました。サービスバスエクスプローラでこれを確認しました。 私は(VS2010を介して)私の開発マシンと接続しようとしましたが、動作しません。私は、サービスとクライアントの両方で、私が考えることができる設定のすべての組み合わせを試みるが、何も変更しようとしました。 ほとんどの場合、クライアントで2つのエラーのいずれかが発生します。Azure AppFabric Service Busエコーサンプルが機能しない

"ContractDescription 'IEchoContract'には操作がありません。契約には少なくとも1つの操作が必要です。

または

"メッセージを受け入れることができるエンドポイントはありませんでした"。

これはサーバーコードですが、私の変更はカスタムコメントの間です。

// create the service URI based on the service namespace 
     Uri address = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace, "EchoService"); 

     // create the credentials object for the endpoint 
     TransportClientEndpointBehavior sharedSecretServiceBusCredential = new TransportClientEndpointBehavior(); 
     sharedSecretServiceBusCredential.CredentialType = TransportClientCredentialType.SharedSecret; 
     sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerName = issuerName; 
     sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerSecret = issuerSecret; 

     // create the service host reading the configuration 
     ServiceHost host = new ServiceHost(typeof(EchoService), address); 

     // custom 
     host.AddServiceEndpoint(
        typeof(IEchoContract), 
        new NetTcpRelayBinding(), 
        "EchoService"); 
     // custom end 

     // create the ServiceRegistrySettings behavior for the endpoint 
     IEndpointBehavior serviceRegistrySettings = new ServiceRegistrySettings(DiscoveryType.Public); 

     // add the Service Bus credentials to all endpoints specified in configuration 
     foreach (ServiceEndpoint endpoint in host.Description.Endpoints) 
     { 
      endpoint.Behaviors.Add(serviceRegistrySettings); 
      endpoint.Behaviors.Add(sharedSecretServiceBusCredential); 
     } 

     // open the service 
     host.Open(); 

これは、クライアントコードで、私の現在の変更は、カスタムのコメントとの間にある:

// create the service URI based on the service namespace 
     Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace, "EchoService"); 

     // create the credentials object for the endpoint 
     TransportClientEndpointBehavior sharedSecretServiceBusCredential = new TransportClientEndpointBehavior(); 
     sharedSecretServiceBusCredential.CredentialType = TransportClientCredentialType.SharedSecret; 
     sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerName = issuerName; 
     sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerSecret = issuerSecret; 

     // create the channel factory loading the configuration 
     //ChannelFactory<IEchoChannel> channelFactory = new ChannelFactory<IEchoChannel>("RelayEndpoint", new EndpointAddress(serviceUri)); 

     // custom 
     ServiceEndpoint endpoint = new ServiceEndpoint(new ContractDescription("IEchoContract", "Microsoft.ServiceBus.Samples"), new NetTcpRelayBinding(EndToEndSecurityMode.Transport, RelayClientAuthenticationType.None), new EndpointAddress(serviceUri)); 
     ChannelFactory<IEchoChannel> channelFactory = new ChannelFactory<IEchoChannel>(endpoint); 
     // custom end 


     // apply the Service Bus credentials 
     channelFactory.Endpoint.Behaviors.Add(sharedSecretServiceBusCredential); 

     // create and open the client channel 
     IEchoChannel channel = channelFactory.CreateChannel(); 
     channel.Open(); 

私のapp.configファイルは、設定がクリアされています。他のファイルには触れていません。

答えて

1

これは、ラボの名前空間が「古い」アプリケーションと異なるためです。私は今それを働かせる方法を知らない。ちょうどかなり "マイクロソフト"もう一度...

0

私は同じ問題を抱えていました。私がそれをデバッグしたとき、configから来るissuerKeyが "yourkey"であることがわかりました。これらの値は、Azureプロジェクト自体のServiceConfiguration.cscfgファイルに格納されます。あなたはそこにいくつかの本当の価値を置く必要があり、それはOKであるはずです。

0

私は同じ問題を抱えていますが、私はこの例では独自のサービスバスが必要だと考えています。 ポータルにサービスバスを作成し、発行者キーの値をコピーして秘密を発行します。

関連する問題