通过WCF打开IE [英] Opening IE through WCF

查看:62
本文介绍了通过WCF打开IE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows服务中托管了WCF服务.

I have a WCF service hosted in a Windows service.

WCF的这项服务只有一个方法,在这种方法中,我有一条重要的代码:

This service the WCF have one metohd and in this method I have one important line :

 Process Browser = Process.Start("iexplore.exe", hostUrl);

我将Windows服务安装为本地系统,但是当我尝试调用该方法时,似乎一切都执行了,除了一条重要的代码……而IE没有打开.

I install Windows service as local system, but when I'm trying to invoke that method, everything seems to execute, except that one important line... and IE didn't open.

我想补充一点,该方法本身不在服务本身中,而是在服务dll参考之一中

I would like to add that the method itself is not in the service itself but in one of the service dll reference

知道为什么吗?

推荐答案

自Windows Vista MS以来,已经添加了许多与安全性相关的已更改esp.Windows服务不能/不能执行的操作.任何类似于桌面"的东西(打印,访问网络共享,使用Office Interop等)都变得越来越困难.

Since Windows Vista MS has been adding lots of security-related changed esp. in the area what Windows Services can/can't do. Anything "desktop-like" (printing, accessing network shares, using Office Interop etc.) is harder and harder to get working.

您应该重新考虑您的设计,因为恕我直言,任何类似于服务器的进程"(例如WCF服务)都可以被多个请求并行访问,因此不应使用非为此类交互而设计的进程...如果您的Web服务以这种方式启动多个IE实例怎么办?IE会按照您的期望/期望表现吗?

You should rethink your design since IMHO any "server-like process" (for example a WCF service) can be accessed in parallel by multiple requests and thus should NOT use processes which are NOT designed for this type of interaction... what happens if your webservice starts multiple IE instances that way ? Will IE behave as you need/expect it ?

如果您真的必须以这种方式这样做

IF you really really MUST do it this way you should have

  • 托管WCF服务的常规桌面进程

  • 两个进程,一个是Windows服务,另一个是作为处理IE的普通桌面进程运行...这两个进程通过IPC进行通信

这篇关于通过WCF打开IE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆