简体   繁体   中英

Find machine name and IP address in OOB SL5 app

在浏览器外运行Silverlight 5应用程序时(如安装在本地计算机上而不是通过Web运行),如何获取客户端计算机名称和IP地址?

It looks like there's no way to gather this information using just Silverlight. You'd have to do something like this . The short version is you use an AutomationFactory to create an unmanaged object which contains that information (in this case, a WMI Win32_NetworkAdapterConfiguration object). That means this probably won't work on a Mac. If you need something truly cross platform, it seems like the way is to create a really simple web service that simply returns the requestor's IP and hostname.

I dont know what is your exact requirement .We had similar requirement some time back to get the local ip address to call a local service which is supposed to be present in client machine.

In that case we just built the local service url by hard coding the loopback address.ie localhost.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM