locked
WFC migrating class from Windows 7 application to Windows 8 App RRS feed

  • Question

  • Hello

    I'm migrating some classes that were developed on Windows 7 and performs communication between two aplicatives (client and server). One of these applicatives is now going to be implemented as Windows 8 App (client) and I'm trying to set up the communication with the other (server). 

    I'm trying to make the following code to run on client side:

     	NetTcpBinding binding = new NetTcpBinding();
            binding.Security.Mode = SecurityMode.None;
            
            pipeFactory = new DuplexChannelFactory<ITeacherInterface>(this,binding, new EndpointAddress("net.tcp://"+ip+":"+mainPort+"/TeacherServer"));

    I get the error for the "binding" parameter

    Error 8 Argument 2: cannot convert from 'System.ServiceModel.Channels.Binding' to 'string'...

    So it seems that for some reason it is using the overload

    DuplexChannelFactory<TChannel>(InstanceContext, String, EndpointAddress)

    instead of the one I want, which is

    DuplexChannelFactory<TChannel>(InstanceContext, Binding, EndpointAddress)

    Why? 

    Second the documentation both are suported by Windows 8

    http://msdn.microsoft.com/en-us/library/ms576164.aspx

    The code works fine on my Win 7 and takes the correct overload.

    Another thing I had to change was the SessionMode

    [ServiceContract(SessionMode = SessionMode.Required,
          CallbackContract = typeof(IStudentsInterfaceCallback))]

    on the contracts definition (since it is not suported on Windows 8). So I just deleted and now it is like this:

    [ServiceContract(CallbackContract = typeof(IStudentsInterfaceCallback))]

    Is there any problem? Should I do something else?

    Thanks a lot for your attention

    Diogo


    Monday, November 26, 2012 12:50 AM

Answers

  • Could you try with the first argument be

    new InstanceContext(this)// instead of this

    • Marked as answer by diogo.krobath Monday, November 26, 2012 11:23 PM
    Monday, November 26, 2012 7:26 AM

All replies

  • Could you try with the first argument be

    new InstanceContext(this)// instead of this

    • Marked as answer by diogo.krobath Monday, November 26, 2012 11:23 PM
    Monday, November 26, 2012 7:26 AM
  • It worked :)

    Thanks a lot!

    Monday, November 26, 2012 11:23 PM
  • Hello

    I'm having a problem regarding the behaviour of the app.

    Not all the events triggered by my client goes to the callback desirable on Windows 8 Store App.

    I'm testing with the old client (Windows 7 based, but still work well in Windows 8 environment) and the new client (Windows 8 Store App) at the same time (in the same machine) in Debug mode and "listening" the server events (the server is also in the same machine).

    The old client works well and the new client miss certain callbacks.

    Besides the change proposed on this forum (and of course graphic interfaces)... the contracts, codes for the business logic are pretty much the same... I still dont get this difference of behaviour.

    Before going into code details, is there anything specific that I have to configure on my Windows 8 App in order to allow this kind of resources to work fully ?

    Thanks for your atention.

    Diogo






    Wednesday, December 5, 2012 1:01 AM