接收NotFound CommunicationException在Silverlight3WCF客户
-
22-09-2019 - |
题
我得到一个非常无益的CommunicationException当试图呼叫WCF服务从Silverlight3.该消息的唯一的例外是"远程服务器返回一个错误:NotFound." 每个内部异常鹦鹉同样的信息。是有一个问题与我的设置,可能会导致这个问题?
这是我的设置。WCF服务举办的Windows服务上运行。净4.0的平台。它有三个终点:
- 主要终端使用pollingDuplexHttpBinding约束力和具有的地址"DashboardService"
- 元数据交换的终点使用mexHttpBinding约束力和具有的地址"墨西哥"
- 该政策提供终点(这需要允许跨域电话)使用webHttpBinding约束力和具有的地址"".
这里是整个系统。serviceModel部分:
<system.serviceModel>
<extensions>
<bindingExtensions>
<add name="pollingDuplexHttpBinding" type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement, System.ServiceModel.PollingDuplex, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</bindingExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="PolicyProviderBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="RoboTrader.TheFloor.DashboardService">
<endpoint address="" binding="webHttpBinding"
behaviorConfiguration="PolicyProviderBehavior"
contract="RoboTrader.DashboardService.IPolicyProvider"/>
<endpoint address="DashboardService" binding="pollingDuplexHttpBinding"
contract="RoboTrader.DashboardService.IDashboardService"/>
<endpoint address="DashboardService/mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
在控客户的代码,我增加了一个服务基准,这似乎有工作只是罚款。和客户获取跨领域政策的业务如预期的那样。然而,当我打电话的主要DashboardService方法,我获得CommunicationException,并断点在我的服务器的端的方法是从来没有达到。这里是控ClientConfig文件所产生的增加的业务参考:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="PollingDuplexHttpBinding_IDashboardService">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:8732/DashboardService"
binding="customBinding"
bindingConfiguration="PollingDuplexHttpBinding_IDashboardService"
contract="Service.IDashboardService"
name="PollingDuplexHttpBinding_IDashboardService" />
</client>
</system.serviceModel>
是否有任何问题,这个安装,或者是否有任何额外的事情,我需要做得到的一个投票双HTTP结合到工作?或者你至少知道我如何可以获得更多的信息,问题是什么?
编辑:
我只是试图设立的客户和服务通过绑定代码,而不是看它是否会有所帮助,但我仍然得到相同的例外。这里的服务器编码:
var dboardService = new DashboardService();
ServiceHost host = new ServiceHost(dboardService);
host.AddServiceEndpoint(
typeof(IDashboardService),
new CustomBinding(
new PollingDuplexBindingElement(),
new BinaryMessageEncodingBindingElement(),
new HttpTransportBindingElement()),
"DashboardService");
host.Open();
和这里的客户代码:
private IDashboardService _svc = new DashboardServiceClient(
new PollingDuplexHttpBinding(),
new EndpointAddress("http://localhost:8732/DashboardService"));
编辑2:
我试图改变的客户的代码这一点,但同样的问题发生:
private IDashboardService _svc = new DashboardServiceClient(
new CustomBinding(
new PollingDuplexBindingElement(),
new BinaryMessageEncodingBindingElement(),
new HttpTransportBindingElement()),
new EndpointAddress("http://localhost:8732/DashboardService"));
解决方案
你们一定是在开玩笑我!我发现为什么这不是工作中的一篇文章,题为MSDN 网络安全的访问限制在Silverlight:
一个附加的限制使用座类是目的地港口范围,网络应用程序是允许连接到必须在范围4502-4534."
后改变我的口号4505,服务器编码达成后,出请求从塞浦路斯?
其他提示
尝试创造终端通过代码,完全相同的方式你这样做了。但在客户面创建代理像这样。
CustomBinding binding = new CustomBinding(
new PollingDuplexBindingElement(),
new BinaryMessageEncodingBindingElement(),
new HttpTransportBindingElement());
private IDashboardService _svc = new DashboardServiceClient(binding,
new EndpointAddress("http://localhost:8732/DashboardService"));
不隶属于 StackOverflow