我有一个通过 Windows azure 中继的客户端/服务器应用程序。这在服务器和客户端都使用控制台应用程序时效果很好。
现在我想使用 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 一起使用?