Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advertise C# WCF app so that it appears in the Network explorer #113

Open
lathoub opened this issue May 22, 2022 · 0 comments
Open

Advertise C# WCF app so that it appears in the Network explorer #113

lathoub opened this issue May 22, 2022 · 0 comments

Comments

@lathoub
Copy link

lathoub commented May 22, 2022

Hi

I have made a c# application that expose a WCF service and I would like to advertise that service in Windows using SSDP.

My Question: - what do I have to do so that it becomes visible in the Network Explorer (in the green circle in the attached screenshot) (similar to the 2 synology NAS's)

Screenshot 2022-05-22 at 09 34 23

Here is what I currently do :

From the examples, I was able to make the server example work:

// Create the device(s) we want to publish.
var url = new Uri("http://192.168.0.245:8181/");

var rootDevice = new SsdpRootDevice()
{
DeviceType = "Basic",
    FriendlyName = "Sample RSSDP Device",
    Manufacturer = "RSSDP",
    ManufacturerUrl = new Uri("https://github.com/Yortw/RSSDP"),
    ModelDescription = "Test Device from RSSDP Console App",
    ModelName = "RSSDP Sample Device",
    ModelNumber = "123", 
    ModelUrl = new Uri("https://github.com/Yortw/RSSDP"),
    SerialNumber = "123",
    CacheLifetime = TimeSpan.FromMinutes(30),
    PresentationUrl = new Uri("http://192.168.0.245:8080/unit15/v1.0/"),
    Uuid = System.Guid.NewGuid().ToString(),
    UrlBase = url
};

var service = new SsdpService()
{
    ServiceType = "Dummy",
    Uuid = System.Guid.NewGuid().ToString(),
    ServiceTypeNamespace = "",
    ControlUrl = new Uri("/dummy", UriKind.Relative),
    EventSubUrl = new Uri("/dummy", UriKind.Relative),
    ScpdUrl = new Uri("/ssdp/dummy.xml", UriKind.Relative)
};
rootDevice.AddService(service);

rootDevice.Location = new Uri(url, "ddd");

The HttpListener serves the above document just fine on http://192.168.0.245:8181/ddd.

<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <URLBase>http://192.168.0.245:8181/</URLBase>
  <device>
    <deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType>
    <friendlyName>Sample RSSDP Device</friendlyName>
    <manufacturer>RSSDP</manufacturer>
    <manufacturerURL>https://github.com/Yortw/RSSDP</manufacturerURL>
    <modelDescription>Test Device from RSSDP Console App</modelDescription>
    <modelName>RSSDP Sample Device</modelName>
    <modelNumber>123</modelNumber>
    <modelURL>https://github.com/Yortw/RSSDP</modelURL>
    <presentationURL>http://192.168.0.245:8080/unit15/v1.0/</presentationURL>
    <serialNumber>123</serialNumber>
    <UDN>uuid:e5d01f19-e113-42e3-aa08-1648e439d1bc</UDN>
    <serviceList>
      <service>
        <serviceType>urn::service:Dummy:1</serviceType>
        <serviceId>urn::serviceId:4ddedf43-0c6e-4080-8e73-f73cb8ad2d56</serviceId>
        <SCPDURL>/ssdp/dummy.xml</SCPDURL>
        <controlURL>/dummy</controlURL>
        <eventSubURL>/dummy</eventSubURL>
      </service>
    </serviceList>
  </device>
</root>

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant