您的位置:首页 > 其它

发布有 Excel Word 操作的站点解决方法

2013-02-16 18:45 423 查看
配置过程:

(1)网站按 release X86 发布

(2)iis设为兼容32位
【英文的】
Enable 32-bit Server Applications on 64-bit Machines

ASP.NET applications that use TX Text Control .NET Server must be compiled for 32-bit platforms (see this article).

IIS must be configured to execute these 32-bit applications. Generally, all applications will be executed in 64-bit mode.

1. Enable IIS's 32-bit support

Open a command prompt and type in the following command:

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

This command enables the 32-bit mode in IIS.

2. Install the IIS 32-bit extensions

Open a command prompt and type the following command:

%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

This command installs the 32-bit web extensions for .NET Framework 2.0.

3. Activate .NET Framework 2.0 32-bit in IIS

In the IIS-Manager, select the 'ASP.NET v2.0.50727 (32bit)' in the 'Web Service Extensions' panel and check 'allow' to activate it.

4. Restart the IIS by opening a command prompt:

iisrestart

【中文的】
IIS6上的做法:
1.命令行键入:
cscript.exe %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1
即设置IIS6允许32位程序运行在64位机器上
2.重新注册.net FrameWorks
%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
3.完成之后,应该会看到多出一个32位的asp.net,如下图:
将其设置为允许,缺点:这样会使整个IIS上的所有站点都以32位兼容方式运行
然后再运行一下:%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
这样就可以跑32位的程序了。

(3)进入32位的组件管理
1、开始->运行->mmc -32

2、文件-添加/删除管理单元

3、从“可用的管理单元”中找到“组件服务”,添加到“所管理单元”,点击“确定”即可

4、添加完之后,即可在此看到word文档。。接下来配置,你懂的~

(4)组件设置权限(可执行文件也设了权限)
检索 COM 类工厂中 CLSID 为 {000209FF-0000-0000-C000-000000000046} 的组件时失败,原因是出现以下错误: 80070005。

控制面板-》管理工具-》组件服务-》计算机-》我的电脑-》DCom配置-》找到Microsoft Word文档
之后
单击属性打开此应用程序的属性对话框。
单击"安全"选项卡,分别在"启动和激活权限"和"访问权限"组中选中"自定义",然后
自定义->编辑->添加ASP.NET账户和IUSER_计算机名

(5)修改web.config(需要明文加入管理员密码)
<system.web>
<identity impersonate="true" userName="administrator" password="227"/>
</system.web>

Windows Server 2008

在VS2010 中写了一个EXCEL的导出功能的东西,但在Windows Server 2008 X64上发布后遇到个问题,EXCEL文件确实存在,但.net调用的EXCEL却不能打开这个EXCEL文件,代码执行到打开文件的时候报错,抛出异常如下:

Microsoft Office Excel 不能访问文件“XXXXX.xls”。 可能的原因有:

? 文件名称或路径不存在。
? 文件正被其他程序使用。
? 您正要保存的工作簿与当前打开的工作簿同名

此代码在2003的服务器上运行的没有问题,在给工作目录加上了相应的权限后发现问题依旧。无奈,上网去转了一圈,找到了一个解决方法,以下是其中关键的部分:

This solution is ...

?Windows 2008 Server x64
Please make this folder.

C:/Windows/SysWOW64/config/systemprofile/Desktop

?Windows 2008 Server x86

Please make this folder.

C:/Windows/System32/config/systemprofile/Desktop

...instead of dcomcnfg.exe.

This operation took away office automation problems in my system.

A Desktop folder seems to be necessary in the systemprofile folder to open file by Excel.

It disappears from Windows2008, Windows2003 had the folder,
and I think it cause this error.

即在C:/Windows/System32/config/systemprofile和C:/Windows/SysWOW64/config/systemprofile目录下创建名为Desktop目录即可解决问题。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: