我正在为我的应用程序实现WCF发现。一切正常,除了我们网络中的虚假交通
在Wireshark的帮助下,我发现服务发送" Hello","探测"和"解决"消息到239.255.255.250:3702地址。根据WCF发现规范,客户端应发送" Hello","探测"查找服务和服务的消息应该发送公告"您好"使用托管发现时的消息
据我所知,当没有搜索时,服务没有理由广播消息。客户应该发送" Hello / Probe"消息和服务应回答" ResolveMatches / ProbeMatches"消息一次。
有没有办法关闭服务的这种行为?
我的配置文件:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="Base">
<endpointDiscovery>
<extensions>
<interfaces>192.168.36.16</interfaces>
</extensions>
</endpointDiscovery>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="RadioServer">
<serviceDiscovery />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="Base" receiveTimeout="Infinite">
<reliableSession inactivityTimeout="00:00:15" enabled="true" />
<security mode="None">
<transport clientCredentialType="Windows" protectionLevel="Sign" />
</security>
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="RadioServer" name="Server.RadioServer">
<endpoint address="RS" behaviorConfiguration="Base" binding="netTcpBinding"
bindingConfiguration="Base" contract="Common.IRadioService" />
<endpoint name="udpDiscovery" kind="udpDiscoveryEndpoint" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://0.0.0.0:8888/" />
</baseAddresses>
</host>
</service>
</services>
示例&#34; Hello&#34;,&#34;探测&#34;,&#34;解决&#34;来自服务的消息:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsd="http://schemas.xmlsoap.org/ws/2005/04/discovery">
<soap:Header>
<wsa:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To>
<wsa:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Resolve</wsa:Action>
<wsa:MessageID>urn:uuid:95bc52ec-e466-41b4-971a-3ae6dfe6f864</wsa:MessageID>
</soap:Header>
<soap:Body>
<wsd:Resolve>
<wsa:EndpointReference>
<wsa:Address>urn:uuid:9525082d-d921-40f6-b81e-5c953bec55c1</wsa:Address>
</wsa:EndpointReference>
</wsd:Resolve>
</soap:Body>
</soap:Envelope>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:wsdp="http://schemas.xmlsoap.org/ws/2006/02/devprof" xmlns:pub="http://schemas.microsoft.com/windows/pub/2005/07">
<soap:Header>
<wsa:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To>
<wsa:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Hello</wsa:Action>
<wsa:MessageID>urn:uuid:d950c11f-46a5-408b-8e54-d530f225af89</wsa:MessageID>
<wsd:AppSequence InstanceId="6" SequenceId="urn:uuid:330912d7-9365-4029-8fbc-f93749e46089" MessageNumber="487489"></wsd:AppSequence>
</soap:Header>
<soap:Body>
<wsd:Hello>
<wsa:EndpointReference>
<wsa:Address>urn:uuid:9525082d-d921-40f6-b81e-5c953bec55c1</wsa:Address>
</wsa:EndpointReference>
<wsd:Types>wsdp:Device pub:Computer</wsd:Types>
<wsd:MetadataVersion>950</wsd:MetadataVersion>
</wsd:Hello>
</soap:Body>
</soap:Envelope>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:wsdp="http://schemas.xmlsoap.org/ws/2006/02/devprof">
<soap:Header>
<wsa:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To>
<wsa:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</wsa:Action>
<wsa:MessageID>urn:uuid:3785aebe-d04b-48fc-8010-5403a56777fd</wsa:MessageID>
</soap:Header>
<soap:Body>
<wsd:Probe>
<wsd:Types>wsdp:Device</wsd:Types>
</wsd:Probe>
</soap:Body>
</soap:Envelope>