[Mono-dev] help: is AnnouncementService working on Mono
Gerjan Dokter
gerjan.dokter at gmail.com
Thu Apr 19 12:02:54 UTC 2012
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);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120419/80ec1e19/attachment.html>
More information about the Mono-devel-list
mailing list