none
Silverlight 3 with WCF Callback Service; The remote server returned an error: NotFound

    Question

  • Hi guys,I’ve searched and tried all day but I keep getting the same error:  “The remote server returned an error: NotFound.” I’ve search on the web and checked every setting and file. This is the situation:

    Based on the two articles of MSDN (http://msdn.microsoft.com/en-us/library/dd470106(VS.95).aspx#Mtps_DropDownFilterText and http://msdn.microsoft.com/en-us/library/dd470097(VS.95).aspx) I’ve made a Silverlight 3 project with a WCF Service. But instead of using the custom WCF Service, I made a Duplex Service.

    The Service gives no errors, the client neither, but at run time when I call the function (getStatus) of the WCF Service I get the error on the yellow line in the following function in the referece;Public Sub EndgetStatus(ByVal result As System.IAsyncResult) Implements MyServiceRef.MyService.EndgetStatusDim _args((0) - 1) As Object

    MyBase.EndInvoke("getStatus", _args, result)

    End SubCheers!

     

    Tuesday, August 11, 2009 10:58 AM

All replies

  • You'll have to provide more information since the wcf service will throw a "Not found" exception in 99.9999999% of all wrong situations

    Tuesday, August 11, 2009 11:15 AM
  • Oke... well, like a said; I'm using Silverlight 3, trying to make a WCF callback service based on the two articles on MSDN.

    I get the error in the reference on the EndgetStatus function.

    My service looks like:

    <ServiceContract(CallbackContract:=GetType(ITestCallbackService), Namespace:="")>
    _<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
    _<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Required)>
    _Public Class MyService    
     Private client As ITestCallbackService    

     <OperationContract(IsOneWay:=True)> _   
     Public Sub getStatus()       
      Try           
       client = OperationContext.Current.GetCallbackChannel(Of ITestCallbackService)()           
       If Not IsNothing(client) Then               
        CallClient()           
       End If       
      Catch ex As Exception           
       Dim mes As String = ex.Message       
      End Try   
     End Sub    

     Private Sub CallClient()       
      client.showStatus("berichtje van de server \o/")   
     End Sub End Class Public Interface ITestCallbackService
    End Class

    Public Interface ITestCallbackService  
     <OperationContract(IsOneWay:=True)> _   
     Sub showStatus(ByVal s As String)
    End Interface

    My webconfig contains:     

    <system.serviceModel>
     <behaviors>                 
      <serviceBehaviors>                       
       <behavior name="MyServiceBehavior">                            
        <serviceMetadata httpGetEnabled="true"/>                            
        <serviceDebug includeExceptionDetailInFaults="true"/>                       
       </behavior>                 
      </serviceBehaviors>           
     </behaviors>   
     <extensions>     
      <bindingExtensions>       
       <add name="pollingDuplexHttpBinding" type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement, System.ServiceModel.PollingDuplex, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />     
      </bindingExtensions>   
     </extensions>   
     <bindings>     
      <pollingDuplexHttpBinding />                 
     </bindings>           
     <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>           
     <services>                 
      <service behaviorConfiguration="MyServiceBehavior" name="MyService">                       
       <endpoint address="" binding="pollingDuplexHttpBinding" contract="MyService"/>                       
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>                 
      </service>           
     </services>     
    </system.serviceModel>

    And in the Silverlight project I define my client like:

    Private endPointadr As EndpointAddress
    Private WithEvents MyWCFClient As MyServiceRef.MyServiceClient
    Private bind As New PollingDuplexHttpBinding()

    endPointadr = New EndpointAddress("http://localhost:53127/MyService.svc")
    MyWCFClient = New MyServiceRef.MyServiceClient(bind, endPointadr)

    Wednesday, August 12, 2009 2:32 AM
  • If you go to http://localhost:53127/MyService.svc in your browser, do you see the default WCF help page for a service? If you do, the problem is on the client. If you don't it is on the server.

    Is http://localhost:52127 also the site where your silverlight application is hosted? If not, you may have to configure a cross-domain policy file along your WCF service.

    How was the client proxy created? Did you use Add Service Reference/Update Service Reference to the most recent version of your service?

    Is there any particular reason you are using InstanceContextMode.PerSession on the server side?

    Thursday, August 13, 2009 5:54 PM
  • You may also want to check out the end to end sample of setting up a silverlight client to a WCF service exposed over a polling duplex binding at http://tomasz.janczuk.org/2009/07/pubsub-sample-using-http-polling-duplex.html.

    Thursday, August 13, 2009 5:57 PM
  • Hi,

    When I open the service in the browser evenything works fine, so big chanse the problem is on the client side.

    I run/host both the website and server local. So I gues I don’t need a cross-domein policy.

    And indeed I used Add Service Reference and I’ve update the reference.

    I really didn’t had a reason to use InstanceContextMode.PerSession. But when I change it to InstanceContextMode.Single and update the reference, there is still no change; same error on the same place.

    Cheers.

    Friday, August 14, 2009 3:45 AM
  • one possible reason for this error is :

     check the binding of the service in the web.config of the service... it should match with the binding of the object on client side...

     

    binding="basicHttpBinding"

    BasicHttpBinding binding = new BasicHttpBinding();

     

    hope this will help.

    Thursday, January 21, 2010 8:40 AM
  • Hi, I had this same error when I accidentally decorated a WCF method with [OperationBehavior] in stead of [OperationContract].
    Thursday, February 18, 2010 6:21 AM