Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF Service (dll) host application
    primarykey
    data
    text
    <p>I have a WFC(4.0) service dll for which I have to create a host application. The dll is pretty simple and has the following interfaces:</p> <pre><code> [ServiceContract(CallbackContract=typeof(IChatServiceCallback))] public interface IService { [OperationContract] Guid Subscribe(); } public interface IServiceCallback { void NotifyClient(strign message); } </code></pre> <p>My problem comes when I try to create a service. When I create a channel from the client to the host, I get the following exception: <i>"The InstanceContext provided to the ChannelFactory contains a UserObjecct that does not implement the CallbackContractType 'Client.MyServiceReference.IServiceCallback'."</i></p> <p>I found that in the ServiceReference object browser the ClientObject does not contain the IServiceCallback interface. Here my correspoding host code:</p> <pre><code> ServiceHost host = new ServiceHost(typeof(ChatService)); try { host.BeginOpen(new AsyncCallback(OnOpen), host); mre.WaitOne(); if (host.State == CommunicationState.Opened) { Console.WriteLine("Server is running!\nServer listens on the following endpoints:"); foreach (var endp in host.Description.Endpoints) { Console.WriteLine("\t{0}", endp.Address); } Console.WriteLine("Press &lt;Enter&gt; to stop the server..."); Console.ReadLine(); host.Close(); } } catch (Exception ex) { Console.WriteLine("Error: {0}", ex.Message); } </code></pre> <p>How can I create a host application for a Service dll which contains callback interface that is implemented on the client side?</p> <p>ClientSide: try { clientID = client.Subscribe(); &lt;-- Throws exception. } catch(Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK); }</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload