I have a web application that I want to extend by some functionality. The application should be notified via Udp datagram by a remote host, about events triggered by sensor devices.
I have set up the remote host successfully, and also managed to write a simple .NET console application that opens a UdpClient and gets the data via UdpClient.Receive() method onto the console.
Now I want to integrate the Udp interface into my web application hosted in IISExpress 10.0 Express. But it seems like the IIS doesn't let me receive Udp datagrams from a remote host. The UdpClient.Receive() Method just blocks forever. No exception, nothing.
I dont quite get what is the problem here. My console application is able to receive the data on the same port, so it cannot be a firewall/global system misconfiguration. And also when i send some Udp data from a local application to localhost, it works even in IIS. It just seems to block out the Udp traffic from the outer world.
I think, but this is only a guess, that it has something to do with the bindings configured in applicationhost.config. My application is currently only configured to accept http requests on port 5000, which probably leads to IIS only listening for TCP connections on port 5000, but not for UDP on any other port.
This is the code i use, which works great outside of IIS:
UdpClient client;
IPEndPoint local = new IPEndPoint(IPAddress.Any, 3636);
IPEndPoint remote = new IPEndPoint(IPAddress.Any, 0);
client = new UdpClient(remote);
byte[] bytes = client.Receive(ref remote);
Console.WriteLine(bytes.Length);
Any ideas what I could try to make it work?