我们有一个在2003 Server上运行的Windows服务.它使用Word Interop打开源Word文档,然后用它做一些事情.它也适用于Excel和PowerPoint文件.
最近我们尝试将此服务移动到Windows 2008 Server计算机上并且遇到了实际问题.
Microsoft.Office.Interop.Excel.Documents.Open上的Microsoft.Office.Interop.Excel.Workbooks.Open COMException中的COMException
当Windows服务在2008 Server上运行时,我得到上述异常.查看任务管理器,应用程序确实加载正常,但之后不久再次关闭.
我已经阅读了有关Vista和Server 2008的内容,而不再使用Session0,并且已经尝试相应地更改Office DCOM安全属性,包括将运行它们的用户的身份更改为Integrated但无济于事.
有谁知道这是否可行?这是我们系统的一个基本方面,因此我们需要能够做到这一点.
谢谢
dcom windows-services ms-office comexception windows-server-2008
我知道之前曾问过这类问题,但其他方法现在都让我失望了.
正如我们的Windows服务轮询AD,给定一个LDAP(即LDAP://10.32.16.80)和该AD服务器中要搜索的用户组列表.它检索这些给定组中的所有用户,以递归方式搜索这些组以获取更多组.然后将每个用户添加到另一个应用程序认证用户列表中.
这部分应用程序运行成功.但是,我们需要每个用户的友好域名(即他们登录DOMAIN /用户名的一部分)
因此,如果有一个用户属于TEST域,名为Steve:TEST/steve就是他的登录名.我能够在广告中找到史蒂夫,但是我还需要将"TEST"与他的AD信息一起存储.
再一次,通过使用目录搜索器和我给出的LDAP IP,我可以找到'史蒂夫',但是考虑到LDAP IP,我如何才能找到友好的域名?
当我尝试以下代码时,我在尝试访问'defaultNamingContext'时遇到错误:
System.Runtime.InteropServices.COMException(0x8007202A):身份验证机制未知.
这是代码:
private string SetCurrentDomain(string server)
{
string result = string.Empty;
try
{
logger.Debug("'SetCurrentDomain'; Instantiating rootDSE LDAP");
DirectoryEntry ldapRoot = new DirectoryEntry(server + "/rootDSE", username, password);
logger.Debug("'SetCurrentDomain'; Successfully instantiated rootDSE LDAP");
logger.Debug("Attempting to retrieve 'defaultNamingContext'...");
string domain = (string)ldapRoot.Properties["defaultNamingContext"][0]; //THIS IS WHERE I HIT THE COMEXCEPTION
logger.Debug("Retrieved 'defaultNamingContext': " + domain);
if (!domain.IsEmpty())
{
logger.Debug("'SetCurrentDomain'; Instantiating partitions/configuration LDAP entry");
DirectoryEntry parts = new DirectoryEntry(server + "/CN=Partitions,CN=Configuration," + domain, username, password);
logger.Debug("'SetCurrentDomain'; …
Run Code Online (Sandbox Code Playgroud) 在我的C#应用程序中,在Excel Interop dll(作为参考)的帮助下,我正在读/写excel文件.如果我把这个程序移动到没有安装office/excel的系统(想想干净的机器),我就会遇到以下错误.
System.Runtime.InteropServices.COMException(0x80040154):由于以下错误,检索CLSID为{00024500-0000-0000-C000-000000000046}的组件的COM类工厂失败:80040154未注册类(HRESULT异常:0x80040154(REGDB_E_CLASSNOTREG) )).
由于目标机器没有优秀,因此预计会出现上述错误.
我的问题是,除了在目标机器上注册Interop dll之外,还有其他方法可以使用我的程序吗?
我在控制台应用程序中编写了一个C#代码来打开两个excel,并将数据从一个excel复制并粘贴到另一个excel.它工作正常,直到目标excel的可见性为真.但是我需要在执行时隐藏excel.所以我将可见性改为false.喜欢,
_destExcelApp = new Excel.ApplicationClass();
_destExcelApp.Visible = false;
Run Code Online (Sandbox Code Playgroud)
现在它显示了一个例外
呼叫被被叫方拒绝了.(来自HRESULT的异常:0x80010001(RPC_E_CALL_REJECTED))
怎么解决这个?
我正在开发一个Internet Explorer命令按钮,该按钮将在单击后打开特定的网页.这是一段代码(IEApp
是对实例的引用IE.WebBrowser
):
IEApp.Navigate(sURL, ref one, ref two, ref three, ref four);
Run Code Online (Sandbox Code Playgroud)
上面的行抛出以下COMException:
Exception Source: Interop.SHDocVw
Exception Type: System.Runtime.InteropServices.COMException
Exception Message: The requested resource is in use. (Exception from HRESULT: 0x800700AA)
Exception Target Site: Navigate
Run Code Online (Sandbox Code Playgroud)
这在IE6或IE7上不是问题.什么出问题的任何想法?我正在使用AddInExpress来创建命令按钮.
干杯! 基督教
我目前正在尝试实现Interop.MODI.dll(来自Microsoft Office)以使用它应该提供的图像 - >文本功能.但是在做的时候
var modi = new MODI.DocumentClass();
Run Code Online (Sandbox Code Playgroud)
我明白了:
"带有CLSID的COMException 80040154 {40942A6C-1520-4132-BDF8-BDC1F71F547B}".
我有什么办法解决这个问题?
我使用regasm工具注册了DLL:-Problem仍然存在
我尝试将BuildPlatform设置为x86:-Problem仍然存在
我使用Visual Studio 2010 Ultimate和Windows 7 Professional 64Bit并安装了Microsoft Office 2007
编辑:我找到了解决方案:
我需要在MS Office中安装"MS-Office-Document-Imaging"功能才能使其正常工作.(软件 - > MS Office(右键单击 - >编辑) - >添加功能 - > Microsoft Office Document Imaging)
该应用程序是在运行Windows Server 2008 R2的计算机上的IIS 7.5中托管的ASP .NET 4.0中编写的.应用程序池使用集成管理Pipline模式.
当在几个没有任何明显共同点的不同页面上抛出以下异常.我自己无法重现异常,但上周在生产环境中发生了10次.
从堆栈跟踪我看到方法"HttpRequest.GetEntireRawContent"引发的异常,所以我想知道请求是否有问题,例如它太长或包含无效字符.
为了清楚起见,这个异常不会从我编写的代码中抛出,而是来自System.Web命名空间.所以我无法添加尝试...抓住它.
我会很高兴有关异常原因的任何想法或故障排除步骤以找到更多信息.
Exception: System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Web.HttpException (0x80004005): An error occurred while communicating with the remote host. The error code is 0x80070001. ---> System.Runtime.InteropServices.COMException (0x80070001): Incorrect function. (Exception from HRESULT: 0x80070001)
at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
at System.Web.Hosting.IIS7WorkerRequest.ReadEntityCoreSync(Byte[] buffer, Int32 offset, Int32 size)
at System.Web.HttpRequest.GetEntireRawContent()
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.get_Form()
at System.Web.HttpRequest.get_HasForm()
at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
at System.Web.UI.Page.DeterminePostBackMode()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception …
Run Code Online (Sandbox Code Playgroud) 当我的代码尝试创建一个新实例时Microsoft.Office.Interop.PowerPoint.Application
,我有时会得到以下异常:
System.Runtime.InteropServices.COMException (0x80010001): Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80010001 Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)).
at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
Run Code Online (Sandbox Code Playgroud)
我有时会说,因为即使给出相同的输入也不会一直发生.此外,在我的代码的其他部分也会发生(同样缺乏一致性),我也与PowerPoint自动化API进行交互. …
请检查以下代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using iTimeService.dsitimeTableAdapters;
using System.IO;
namespace iTimeService
{
public partial class Service1 : ServiceBase
{
public Service1()
{
InitializeComponent();
}
public zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
private bool bIsConnected = false;//the boolean value identifies whether the device is connected
private int iMachineNumber = 1;//the serial number of the device.After connecting the device ,this value will be changed.
TENTERTableAdapter tenteradapter = new TENTERTableAdapter();
T012_GATETableAdapter gateadapter …
Run Code Online (Sandbox Code Playgroud) 当我TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
在 windows server 的 powershell 中禁用密码时,我收到此错误消息
Disable-TlsCipherSuite : Exception from HRESULT: 0xD0000225
At line:1 char:1
+ Disable-TlsCipherSuite -Name "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Disable-TlsCipherSuite], COMException
+ FullyQualifiedErrorId : Exception from HRESULT: 0xD0000225,Microsoft.WindowsAuthenticationProtocols.Commands.RemoveTlsCipherSuiteCommand
Run Code Online (Sandbox Code Playgroud)
错误是什么意思以及如何修复它?谢谢你的任何建议。
comexception ×10
c# ×5
interop ×4
excel ×2
exception ×2
asp.net ×1
browser ×1
clsid ×1
com ×1
dcom ×1
dns ×1
iis-7.5 ×1
ms-office ×1
powerpoint ×1
powershell ×1