Reputation: 31
Microsoft says that you can customize announcement functionality.
Does anyone have experience on modifying when to send online announcements? Can someone direct me to an example?
I've tried using the AnnounceOnline method but there must be a problem with my code since I get an error indicating that "the target machine refused it"
Upvotes: 1
Views: 86
Reputation: 31
If this could help anyone, here's my answer:
Private Sub AnnounceService()
Dim baseAddress As New Uri(String.Format("net.tcp://{0}:10000", Net.Dns.GetHostEntry(Net.Dns.GetHostName).AddressList(1).ToString()))
Dim serviceHost As New ServiceHost(GetType(WCFService), baseAddress)
Dim endPoint As ServiceEndpoint = serviceHost.AddServiceEndpoint(GetType(IWCFService), New NetTcpBinding(SecurityMode.None), "WCFService")
Dim epAddress As New EndpointAddress(baseAddress)
Dim client As New AnnouncementClient(New UdpAnnouncementEndpoint())
Dim epDiscoveryMetaData = EndpointDiscoveryMetadata.FromServiceEndpoint(endPoint)
client.AnnounceOnline(epDiscoveryMetaData)
End Sub
Upvotes: 0