简体   繁体   中英

Can I open client's Windows Explorer from WCF?

Good morning, I have following scenario: I have solution with two projects - first project is MVC WebClient and second one is WCF Service. I want open Windows explorer on specific location , probably through WCF. I know that it is not possible from pure client so I was thinking if WCF can does it.

Full scenario is: User clicks on button and then windows explorer will be opened.

I have tried do it on my local computer

Process.Start(path); 

and it works, but what if I will host it on IIS?

  1. Will it works?
  2. Will it open client's explorer or server's explorer?
  3. If first two steps will work, will I need host WCF service on IIS too or MVC client with service reference is enough?

And if this scenario won't work, can anyone help with some solution for this problem (if is any)?

Many thanks

The only way I could think of doing this purely with a browser would be to require the client to use IE and then embed an ActiveX control. The page would have to run with the highest security privileges so the ActiveX could run unimpeded. The nice thing about this is it would not require much (if any) server-side support. It would all be handled by Javascript.

Otherwise, to make it browser agnostic, you would have to have a listener app running on the client machine, probably as a service or set to start on machine boot (good candidate for the notification area on the taskbar). The listener app on the client machine could establish a connection to the server using WCF, Sockets (whatever you want really) and then when the user presses the button on the WEB application a message is sent from the web server to the client-side listening application. This of course could trigger anything you want on the client-side.

I see several complications with this as well:

1) How do you get the listener installed on the client machine?

2) Your web application now needs to communicate with a server-side component that is connected to the client-side listener. If you are already using WCF on the server this might not be too bad. If the client-side listener connects to the same web application the user is using it probably wouldn't be too difficult either (use long-polling or web sockets, etc)

3) How do you secure the client-side listener and connect the client-side "session" to the web "session" such that the user clicking on the button in his web browser sends a message to his instance of the client-side listener and not another user's listener.

These are all doable. I wrote an app that worked sort of like this several years ago. There were definitely challenges but we got it working and it has been stable for several years now. We used WCF.

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