私はWindows Azure Relayを介してクライアント/サーバーアプリケーションを持っています。 これは、サーバーとクライアントの両方にコンソールアプリケーションを使用するとうまくいきます。Windows Phone上のAzure ServiceBusリレー
今はWindows Phoneをクライアントとして使用したいのですが、なんらかの理由でサービスバスを呼び出すことができません。 私は、Web参照を追加することはできませんし、ブラウザにURLをターゲットにするとき、私は次のメッセージが出ます:
<s:Fault xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode><faultstring xml:lang="nl-NL">The message with Action 'GET' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</faultstring></s:Fault>
を私は、サーバーのapp.configに次のコードを入力しました:
// sb:// binding
Uri sbUri = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace, "blabla");
var sbBinding = new NetTcpRelayBinding(EndToEndSecurityMode.Transport, RelayClientAuthenticationType.None);
serviceHost.AddServiceEndpoint(typeof(IMyContract), sbBinding, sbUri);
// https:// binding (for Windows Phone etc.)
Uri httpsUri = ServiceBusEnvironment.CreateServiceUri("https", serviceNamespace, "https/" + "blabla");
var httpsBinding = new BasicHttpRelayBinding(EndToEndBasicHttpSecurityMode.Transport, RelayClientAuthenticationType.None);
serviceHost.AddServiceEndpoint(typeof(IMyContract), httpsBinding, httpsUri);
そして、ホストを開く前に、エンドポイントを公開モードに設定します。
Windows Phoneでこの作業を行うには、他に何が必要ですか?
でも私は正しい方向に向いていることを嬉しく思っています。私はbasichttpbindingを通じてWebサービスを呼び出す方法を理解できないようです...通常の呼び出しを使用しようとすると、 Windows PhoneプロジェクトではSystem.ServiceModel 4.0バージョンが利用できないため、servicehostとチャネルを使用してください –
これは魅力的なように機能しました!ありがとうすべては今働いています:) –