UPNP with C# code

0

I am trying to use UPnP(windows sys upnp.dll) with C# but I am having some troubles to figure out how to call UPnPService.InvokeAction. When I call the code below piece of code:

string[] inarr = new[] { "", ""};
object outarr = new object[0];
object rvalue = myservice.InvokeAction("GetCompatibleUIs", inarr, ref outarr);

myservice is of type Service. On running, I get this exception:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in DLNA.exe

Additional information: Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))

here is the interface details for reference: http://msdn.microsoft.com/en-us/library/aa382237(VS.85).aspx

I have tried the same with VBScript and it works without any issue. Here is the VB script version of the same.

dim inarr()
inarr = Array("","")
dim outarr()
dim rvalue
rvalue = myService.InvokeAction("GetCompatibleUIs", inarr, outarr)

Can someone please help me to get this C# code working.

c#
upnp
asked on Stack Overflow Aug 3, 2014 by Amit Chouksey

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0