微软表示您可以自定义公告功能。
有人有修改在线公告发送时间的经验吗?有人可以指导我举个例子吗?
我尝试过使用AnnounceOnline方法,但我的代码一定有问题,因为我收到一条错误,指示“目标机器拒绝它”
如果这可以帮助任何人,这是我的答案:
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