Results 1 to 7 of 7

Thread: [RESOLVED] WCF: Problems creating duplex contract

Threaded View

  1. #1

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Resolved [RESOLVED] WCF: Problems creating duplex contract

    I'm trying to create a duplex contract in my WCF service, which from what I gather requires that you do the following:

    Define an interface in your service, e.g IMyClientCallBack
    Tell your main service to use that interface as its call back contract
    implement the interface in your client

    So I have the following on the server side:

    vb.net Code:
    1. ''' <summary>
    2. ''' Main service
    3. ''' </summary>
    4. <ServiceContract(CallbackContract:=GetType(IProtoChatCallBack), SessionMode:=SessionMode.Required)> _
    5. Public Interface IProtoChatService
    6.  
    7.     <OperationContract()> _
    8.     Function GetServerInfo() As ServerInfoDescription
    9.  
    10.     <OperationContract()> _
    11.     Function GetUserList() As List(Of UserObject)
    12.  
    13.     <OperationContract()> _
    14.     Function SignUserIn(ByVal iUName As String, ByVal iPassword As String) As SignInResult
    15.  
    16.     <OperationContract()> _
    17.     Sub SignUserOut(ByVal iUName As String)
    18.  
    19. End Interface
    20.  
    21. ''' <summary>
    22. ''' Call back contract that will be implemented on client side
    23. ''' </summary>
    24. <ServiceContract()> _
    25. Public Interface IProtoChatCallBack
    26.  
    27.     <OperationContract(IsOneWay:=True)> _
    28.     Sub MessageReceived(ByVal SenderDisplayName As String, ByVal Message As String, ByVal TimeSent As DateTime)
    29.  
    30.     <OperationContract(IsOneWay:=True)> _
    31.     Sub SignUserOut(ByVal Reason As String)
    32.  
    33. End Interface

    However, now when I go to update the service reference on the client (so that I can define an implementation of the call back interface) I just get an error saying "Metadata contains a reference that could not be resolved".
    If I take those 2 methods (MessageReceived and ForceUserSignOut) out of the interface then I can update the service reference on the client fine... but obviously there's not much use having a callback contract that doesnt do anything!

    Anyone see where im going wrong?

    Thanks
    Chris
    Last edited by chris128; Jun 23rd, 2009 at 01:21 PM.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width