您的位置:首页 > 移动开发 > Objective-C

asp调用Excel.Application 出现 Server.CreateObject 的调用失败的解决

2011-03-02 10:49 676 查看
一个简单的例子,Web从excel中读取内容:

<%@language=vbscript%>
<%

Set xlApp = server.CreateObject("Excel.Application")

strsource = "f:/1dw/cl/汉字库.xls"

Set xlbook = xlApp.Workbooks.Open(strsource)
Set xlsheet = xlbook.Worksheets(1)

response.write "<table cellpadding=0 cellspacing=0 border=1 width=500>"

while xlsheet.cells(i,1)<>""

response.write "<tr>"

response.write " <td height=20 align=center width=100>" & xlsheet.Cells(i, 1) & "</td>"
response.write " <td height=20 align=center width=200>" & xlsheet.Cells(i, 2) & "</td>"

response.write " <td height=20 align=center width=200>" & xlsheet.Cells(i, 3) & "</td>"

response.write "</tr>"

i=i+1

wend
response.write "</table>"

set xlsheet=nothing
%>

运行,产生错误

错误类型:
Server 对象, ASP 0178 (0x80070005)
检查权限时,对 Server.CreateObject 的调用失败。拒绝对此对象的访问。

参考网上的方法,摸索以下步骤:

管理工具-->组件服务-->计算机-->我的电脑-->DCOM配置

1.选择Microsoft Excel 应用程序 -->属性

标识:选择交互式用户

安全:启动和激活权限-->自定义,加入InterNet来宾帐户,勾上本地启动和本地激活

访问权限-->自定义,把几个都加上

2.选择Microsoft Office Excel 2007 工作簿 -->属性

常规:身份验证级别 -->无

有人电脑无DCOM配置的属性,解决方法(已验证)

确保下面四个服务是开着的话,那就能确保右键的属性能够出现。
1、Remote Procedure Call (RPC)
2、COM+ Event System
3、DCOM Server Process Launcher

4、Distributed Transaction Coordinator

然后再进入组件服务,就能在DCOM配置中看到右键的属性了,并且组件服务计算机中的"我的电脑"上的那个红色的向下箭头也消失了。
Distributed Transaction Coordinator 服务因 3221229584 (0xC0001010) 服务性错误而停止这个错误,主要是系统无法找到MS DTC 日志文件造成的,只要创建一下就可以了:开始-运行-输入命令"msdtc -resetlog" 然后再启动该服务就可以了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐