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)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 52285 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

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.