Silverlight 3에서 WCF 서비스를 호출 할 때 매우 도움이되지 않는 CommunicationException이 발생합니다. 예외 메시지는 "원격 서버에서 오류 : NotFound를 반환했습니다."입니다. 각 내부 예외는 동일한 메시지를 앵무새로 표시합니다. 이 문제의 원인이 될 수있는 설정에 문제가 있습니까?Silverlight 3 WCF 클라이언트에서 NotFound CommunicationException 수신
내 설정은 다음과 같습니다. WCF 서비스는 .NET 4.0 플랫폼에서 실행되는 Windows 서비스에서 호스팅됩니다. 그것은 세 끝점 가지고
- 메인 끝점 바인딩 pollingDuplexHttpBinding 사용을 어드레스 "DashboardService"
- 메타 교환 끝점 바인딩 mexHttpBinding를 사용하고있다 어드레스 "MEX"
- 엔드 포인트를 제공하는 정책이 (이것은 교차 도메인 호출을 허용해야 함) webHttpBinding 바인딩을 사용하고 주소가 ""입니다.
여기 전체는 system.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이 발생하고 서버 측 메서드에서 중단 점에 도달하지 못합니다.
<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를 얻기 위해해야 할 추가 일들이있다 : 여기에 서비스 참조를 추가하여 생성 된 실버 ClientConfig 파일입니까? 아니면 문제가 무엇인지에 대해 더 많은 정보를 얻을 수있는 방법에 대해 알고 계십니까?
편집 : 난 그냥 도움이 될 경우 대신보고,하지만 난 여전히 동일한 예외가 코드를 통해 클라이언트와 서버 바인딩을 설정하려고
. 여기에 서버 코드입니다 :
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"));
ive 내 응용 프로그램에 대한 8080 - 8085 포트를 사용하고 기술적으로 System.Net.Sockets (포트 4502-4534로 제한됨)를 사용하지 않고 HTTP 대신 다른 곳에 문제가 있다고 생각합니다. 당신이 최소한 그것을 기대할 때 다시 튀어 나오기 전에 – Neil
나는 평범한 HTTP를 사용할 때 더 넓은 범위의 소켓을 사용할 수 있었다. 그러나 이것은'pollingDuplexHttpBinding'을 사용하려고 한 첫 번째 시도였습니다. 포트 번호를 변경하는 것이 일을 시작하기 전에 제가 만든 유일한 수정이라고 확신합니다. 아마 그 제한이 그 바인딩에 적용될 수 있습니다. 이전에 듀플렉스 HTTP 바인딩으로 높은 포트 번호를 사용 했습니까? – Jacob
@Neil : 포트 당 8080-8085의 동일한 http 서버에서 XAP 파일을 배달 했습니까? XAP가 시작된 포트에는 제한이 없으며 XAP에서 해당 포트의 서버로의 다른 HTTP 액세스는 동일한 사이트 액세스로 간주됩니다. – AnthonyWJones