How to host service using UDP in WCF?

2.2k views Asked by At

I am trying to host a service using UDP in WCF but I can't generate a proxy from the service. I need to host the service on a LAN. Can anyone give an example for a server and client using UDP in WCF?

Here is my app.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>

    <extensions>
      <bindingElementExtensions>
        <add name="udp_Transport" type="Microsoft.ServiceModel.Samples.UdpTransportElement, UdpTransport" />
      </bindingElementExtensions>
    </extensions>

    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
          <serviceMetadata httpGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <udpBinding>
        <binding name="UDPBinding" openTimeout="24.20:31:23.6470000" receiveTimeout="24.20:31:23.6470000" sendTimeout="24.20:31:23.6470000" maxBufferPoolSize="10000000" maxReceivedMessageSize="10000000">
          <readerQuotas maxDepth="10000000" maxStringContentLength="10000000" maxArrayLength="10000000" maxBytesPerRead="10000000" maxNameTableCharCount="10000000"/>         
        </binding>
      </udpBinding>
    </bindings>
    <services>
      <service name="UDP_Server.Service1">
        <endpoint address="soap.udp://localhost:40000/Service1/" binding="udpBinding" bindingConfiguration="UDPBinding" contract="UDP_Server.IService1">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>


        <host>
          <baseAddresses>
            <add baseAddress="soap.udp://localhost:40000/Service1/"/>
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
1

There are 1 answers

0
Josep B. On