Remoting failed in Coded UI test cases RRS feed

  • Question

  • If I call following remoting code in a Coded UI test method, it always throws "No connection could be made because the target machine actively refused it". 

    But the code works fine in a winform application, so the server is working fine.

    Is there anything related to MsTest?

                BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
                serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
                BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
                IDictionary props = new Hashtable();
                props["port"] = "1235";
                TcpChannel channel = new TcpChannel(props, clientProv, serverProv);
                ChannelServices.RegisterChannel(channel, true);
                // client machine to send task evt
                string clientName = "localhost";
                string clientPort = RemoteSettings.Port.ToString();
                string clientPath = ("tcp://" + clientName + ":" + clientPort + "/" + RemoteSettings.Identifier);
                // get the server talk remote object hosted in client machine
                object obj = Activator.GetObject(typeof(ServerTalk), clientPath);
                ServerTalk serverTalk = obj as ServerTalk;

    totta wang

    Friday, February 1, 2013 9:42 AM


All replies

  • move the code to WCF - it's working fine in Coded UI test case.

    totta wang

    Saturday, February 2, 2013 4:40 PM
  • Hello Totta,

    Thank you for your post.

    Whether or not you have resolved this issue through moving the code to WCF?

    If yes, I will mark your reply as answer.

    If no, please provide us more and detailed error message  and the latest news of the coded UI test so that we can further look at this issue.

    Best regards,

    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 4, 2013 5:15 AM