ActiveXObject创建错误“自动化服务器无法创建对象" [英] ActiveXObject creation error “ Automation server can't create object”

查看:62
本文介绍了ActiveXObject创建错误“自动化服务器无法创建对象"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



Hi,

<script language="javascript">
   function PrintLabel() 
   {
       var ccc = 0;
       var zp = new ActiveXObject('ZebraPrint.ZebraPrintCtl');
       zp.TcpConnection('66.55.1.2', '6101');
       var i = zp.Print('<?xml version="1.0"?>Test Text</xml>');
       alert(i);
   }
</script>
<body>
<form id="form1">
<div>
  <asp:Button ID="btnPrint" runat="server" Text="Print" OnClientClick="javascript:PrintLabel();return false;" />
</div>
</form>
</body>





在IE 7上运行此脚本,该脚本给出了一个错误,即自动化服务器无法创建对象".我尝试通过在Web服务器上运行时将安全级别更改为自定义级别来做到这一点.

工具菜单->互联网选项->安全->自定义级别-> 初始化和编写未标记为可安全编写脚本的ActiveX控件脚本"

但是它仍然给出相同的错误.
您的建议和意见非常可取.

谢谢





Running this script on IE 7 which is giving an error called "Automation server can''t create object". I tried doing this by changing security levels to a custom level when running on a web server.

Tools Menu -> Internet Options -> Security -> Custom level -> "Initialize and script ActiveX controls not marked as safe for scripting"

But still its giving the same error.
Your suggestions and inputs are highly appreciable.

Thanks

推荐答案

我将Excel和Word设置为以管理员身份运行.我这样做是为了可以将文件保存到我喜欢的任何位置-阻止我将其保存到``Program Files''或``Program Files(x86)''文件夹的努力印象深刻.

其结果是,如果我尝试为Word或Excel创建ActiveX对象,它将失败....除非试图创建这些对象的程序也以Admin身份运行.我将Web服务器设置为很久以前就作为服务运行了,却忘记了这个问题.最近我花了大约一天的时间重新发现了这个小陷阱.我不记得该错误消息是什么,但是我99.98%确信它不包含任何提及安全性或权限问题的信息.


要在测试针对IE设计的内容时解决此问题,我必须以Admin身份启动IE.因为它是开始"菜单中的特殊"快捷方式,所以右键单击以查看该快捷方式的属性,这样我就可以将其设置为始终以管理员身份运行",这只会激起"Internet选项"对话框.因此,可以单击鼠标右键,每隔眨眼一次以Admin身份运行,或者创建一个新的快捷方式.我选择了前者.
I have Excel and Word set to Run as Administrator. I do this so I can save files anywhere that I like - not impressed with the efforts to stop me saving into the ''Program Files'' or ''Program Files (x86)'' folders.

The consequence of this is that if I try to create an ActiveX object for either Word or Excel, it fails.... Unless the program that''s trying to create those objects is also run as Admin. I set the webserver to run as a service a long time ago and forgot about the problem. It took me about a day recently to re-discover that little gotcha. I don''t recall what the error message was, but I''m 99.98% sure it didn''t include anything that mentioned security or permission issues.


To get around this issues when testing stuff designed for IE, I have to start IE as Admin. Which is rather irritating since it''s a ''special'' shortcut in the start menu, right-clicking to see the shortcut''s properties so I can set it to "Always run as Admin" just brings up the Internet Options dialog. So, it''s either right-click, Run as Admin every blinking time, or it''s create a new shortcut. I chose the former..


这篇关于ActiveXObject创建错误“自动化服务器无法创建对象"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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