Bug 52285 - Wcf - discovery managed mode problem
Summary: Wcf - discovery managed mode problem
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 4.6.0 (C8)
Hardware: Other Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-03 16:03 UTC by Oto Dusek
Modified: 2017-03-17 22:49 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Oto Dusek 2017-02-03 16:03:01 UTC
Description of Problem:
OS: Linux 3.14.61-fslc+g327d5c9
I created service "MyService" which work fine on Windows .NET and Mono. But when i want to add discovery behavior to this service:

       MyService rs = new MyService(robotMove);
        var binding = new BasicHttpBinding();
        Uri baseAddress = new Uri($"http://{hostname}:8080/MyService");
        Uri announcementEndpointAddress = new Uri($"net.tcp://192.168.1.100:8082/Announcement");
        using (ServiceHost host = new ServiceHost(rs, baseAddress)) {

            // Enable metadata publishing.
            AnnouncementEndpoint announcementEndpoint = new AnnouncementEndpoint(new NetTcpBinding()), new EndpointAddress(announcementEndpointAddress));
            announcementEndpoint.MaxAnnouncementDelay = TimeSpan.FromMilliseconds(1000);
            announcementEndpoint.IsSystemEndpoint = false;
            // Create a ServiceDiscoveryBehavior and add the announcement endpoint
            ServiceDiscoveryBehavior serviceDiscoveryBehavior = new ServiceDiscoveryBehavior();

            serviceDiscoveryBehavior.AnnouncementEndpoints.Add(announcementEndpoint);

            host.AddServiceEndpoint (typeof(IMyService), binding, baseAddress);

            host.Description.Behaviors.Add(serviceDiscoveryBehavior);
            host.Open();
            ...
        }

it throws exception when i run this code on mono, on Windows .NET it works fine

Steps to reproduce the problem:
1. run code on Mono 4.6.0 on Windows or Linux

Actual Results:
Mono 4.6.0 on linux
    Unhandled Exception:
System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x00052] in <affe4060066c42de8cdd6027cdb92b56>:0
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x000b4] in <affe4060066c42de8cdd6027cdb92b56>:0
   --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr)
  at (wrapper remoting-invoke) System.ServiceModel.ICommunicationObject:Open (System.TimeSpan)
  at System.ServiceModel.Discovery.AnnouncementClient.System.ServiceModel.ICommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Discovery.DiscoveryChannelDispatcher.OnOpen (System.TimeSpan timeout) [0x00018] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.ServiceHostBase.OnOpen (System.TimeSpan timeout) [0x0012b] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.Channels.CommunicationObject.Open () [0x00000] in <b360aa5782e647319a7613b3b28cd812>:0
  at () [0x0014f] in <61b5dec33a7447b9b70b73ffa172f115>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x00052] in <affe4060066c42de8cdd6027cdb92b56>:0
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x000b4] in <affe4060066c42de8cdd6027cdb92b56>:0
   --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr)
  at (wrapper remoting-invoke) System.ServiceModel.ICommunicationObject:Open (System.TimeSpan)
  at System.ServiceModel.Discovery.AnnouncementClient.System.ServiceModel.ICommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Discovery.DiscoveryChannelDispatcher.OnOpen (System.TimeSpan timeout) [0x00018] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.ServiceHostBase.OnOpen (System.TimeSpan timeout) [0x0012b] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.Channels.CommunicationObject.Open () [0x00000] in <b360aa5782e647319a7613b3b28cd812>:0
  at Program.Main () [0x0014f] in <61b5dec33a7447b9b70b73ffa172f115>:0


Mono 4.6.0 on Linux
and when i set NetTcpBinding SecurityMode to None, it throws following exception

System.Xml.Schema.XmlSchemaException: The 'base' attribute is either invalid or missing.
  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr)
  at (wrapper remoting-invoke) System.ServiceModel.Discovery.Version11.IAnnouncementContract11:EndOnlineAnnouncement (System.IAsyncResult)
  at System.ServiceModel.Discovery.Version11.AnnouncementClient11.EndAnnounceOnline (System.IAsyncResult result) [0x00006] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Discovery.AnnouncementClient.EndAnnounceOnline (System.IAsyncResult result) [0x00000] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Discovery.AnnouncementClient.AnnounceOnline (System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata) [0x0000a] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Discovery.DiscoveryChannelDispatcher.OnOpen (System.TimeSpan timeout) [0x0006e] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.ServiceHostBase.OnOpen (System.TimeSpan timeout) [0x0012b] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.Channels.CommunicationObject.Open () [0x00000] in <b360aa5782e647319a7613b3b28cd812>:0
  at Program.Main () [0x00131] in <a68a7460cd32422f8d59a48443847381>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Xml.Schema.XmlSchemaException: The 'base' attribute is either invalid or missing.
  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr)
  at (wrapper remoting-invoke) System.ServiceModel.Discovery.Version11.IAnnouncementContract11:EndOnlineAnnouncement (System.IAsyncResult)
  at System.ServiceModel.Discovery.Version11.AnnouncementClient11.EndAnnounceOnline (System.IAsyncResult result) [0x00006] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Discovery.AnnouncementClient.EndAnnounceOnline (System.IAsyncResult result) [0x00000] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Discovery.AnnouncementClient.AnnounceOnline (System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata) [0x0000a] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Discovery.DiscoveryChannelDispatcher.OnOpen (System.TimeSpan timeout) [0x0006e] in <21211823c90a4f66b03f12b70b1ac179>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.ServiceHostBase.OnOpen (System.TimeSpan timeout) [0x0012b] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <b360aa5782e647319a7613b3b28cd812>:0
  at System.ServiceModel.Channels.CommunicationObject.Open () [0x00000] in <b360aa5782e647319a7613b3b28cd812>:0
  at Program.Main () [0x00131] in <a68a7460cd32422f8d59a4844384>:0



and when i run it on Mono 4.6.0 on Windows i get following exception

Unhandled Exception:
System.ServiceModel.ProtocolException: Preamble Ack Record is expected, got FFFFFFFF
  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr)
  at (wrapper remoting-invoke) System.ServiceModel.ICommunicationObject:Open (System.TimeSpan)
  at System.ServiceModel.Discovery.AnnouncementClient.System.ServiceModel.ICommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <filename unknown>:0
  at System.ServiceModel.Discovery.DiscoveryChannelDispatcher.OnOpen (System.TimeSpan timeout) [0x00018] in <filename unknown>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <filename unknown>:0
  at System.ServiceModel.ServiceHostBase.OnOpen (System.TimeSpan timeout) [0x0012b] in <filename unknown>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <filename unknown>:0
  at System.ServiceModel.Channels.CommunicationObject.Open () [0x00000] in <filename unknown>:0
  at Program.Main () [0x0014f] in <filename unknown>:0
[MVID] 21211823c90a4f66b03f12b70b1ac179 2,3
[MVID] 8f7cf33033464ee9a0178bd0dfa6e8c4 4,5,6,7
[MVID] 90cd33171e184a2e964020e4283ac4ed 8
[ERROR] FATAL UNHANDLED EXCEPTION: System.ServiceModel.ProtocolException: Preamble Ack Record is expected, got FFFFFFFF
  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr)
  at (wrapper remoting-invoke) System.ServiceModel.ICommunicationObject:Open (System.TimeSpan)
  at System.ServiceModel.Discovery.AnnouncementClient.System.ServiceModel.ICommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <filename unknown>:0
  at System.ServiceModel.Discovery.DiscoveryChannelDispatcher.OnOpen (System.TimeSpan timeout) [0x00018] in <filename unknown>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <filename unknown>:0
  at System.ServiceModel.ServiceHostBase.OnOpen (System.TimeSpan timeout) [0x0012b] in <filename unknown>:0
  at System.ServiceModel.Channels.CommunicationObject.Open (System.TimeSpan timeout) [0x00006] in <filename unknown>:0
  at System.ServiceModel.Channels.CommunicationObject.Open () [0x00000] in <filename unknown>:0
  at Program.Main () [0x0014f] in <filename unknown>:0

Expected Results:
It should work on Mono

Regards.

Note You need to log in before you can comment on or make changes to this bug.