[Mono-dev] help: is AnnouncementService working on Mono

Tomasz Kubacki tomasz.kubacki at gmail.com
Fri Apr 20 05:19:53 UTC 2012


Have you considered using ServiceStack ? It's faster than WCF and has first
class support on mono and is way easier to use.
19-04-2012 14:03, "Gerjan Dokter" <gerjan.dokter at gmail.com> napisał(a):

>
> Hello,
>
> My name is Gerjan, and i am working on a Domotica Project which is
> implemented on a DreamPlug(Linux Debian).
>
> For this project i am using WCF Services which is a part of the .NET
> Framework.
>
> My question is if the full functionality of WCF Services is implemented in
> Mono. A more specific question is if the "AnnouncementService"
> functionality is added to mono. Because when i want to add an
> ServiceEndpoint(new UdpAnnouncementEndpoint) to my Servichost with
> servicetype 'announcementservice', the program is returning an error, which
> is:
>
> *Unhandled Exception: System.NullReferenceException: Object reference not
> set to an instance of an object*
> *at System.ServiceModel.Channels.TextMessageEncoder.FillActionContentType*
>
> I am looking forward to your answer,
>
> Sincerly,
>
> Gerjan
>
> below my  code:
>
>    class Program
>    {
>        static void Main(string[] args)
>         {
>            // Create an AnnouncementService instance
>            AnnouncementService announcementService = new
> AnnouncementService();
>
>            // Subscribe the announcement events
>             announcementService.OnlineAnnouncementReceived +=
> OnOnlineEvent;
>            announcementService.OfflineAnnouncementReceived +=
> OnOfflineEvent;
>
>            // Create ServiceHost for the AnnouncementService
>             using (ServiceHost announcementServiceHost = new
> ServiceHost(announcementService))
>            {
>                // Listen for the announcements sent over UDP multicast
>                announcementServiceHost.AddServiceEndpoint(new
> UdpAnnouncementEndpoint());
>                 announcementServiceHost.Open();
>                Console.WriteLine("Press <ENTER> to terminate.");
>                Console.ReadLine();
>                announcementServiceHost.Close();
>             }
>        }
>
>
>        static void OnOnlineEvent(object sender, AnnouncementEventArgs e)
>        {
>            Console.WriteLine("Received an online announcement from
> {0}", e.EndpointDiscoveryMetadata.Address);
>             Console.WriteLine("Received an online announcement from {0}",
> e.EndpointDiscoveryMetadata.ContractTypeNames.ToString());
>            Console.WriteLine("Received an online announcement from {0}",
> e.EndpointDiscoveryMetadata.ListenUris.ToString());
>             Console.WriteLine("Received an online announcement from {0}",
> e.EndpointDiscoveryMetadata.Version);
>        }
>
>        static void OnOfflineEvent(object sender, AnnouncementEventArgs e)
>         {
>            Console.WriteLine("Received an offline announcement from {0}",
> e.EndpointDiscoveryMetadata.Address);
>            Console.WriteLine("Received an offline announcement from
> {0}", e.EndpointDiscoveryMetadata.ContractTypeNames.ToString());
>             Console.WriteLine("Received an offline announcement from {0}",
> e.EndpointDiscoveryMetadata.ListenUris.ToString());
>            Console.WriteLine("Received an offline announcement from {0}",
> e.EndpointDiscoveryMetadata.Version);
>         }
>    }
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120420/e94622d8/attachment.html>


More information about the Mono-devel-list mailing list