2017-12-17 2 views
0

Outlook에서 전자 메일을 보내는 C# exe가 있는데 수동으로 실행하면 제대로 작동합니다.Outlook에서 전자 메일을 보내는 동안 오류가 발생했습니다.

내가 작업 스케줄러를 통해 실행하려고하고 있지만 다음과 같은 오류 제공합니다

System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)). 
at sendMail.Program.Main(String[] args) in D:\Recovered\Root\Projects\sendMail\sendMail\Program.cs:line 20 

답변

0

해킹을 발견했습니다. 나는 예외를 수정할 수 있었지만 마이크로 소프트가 COM 개체가 서비스를 통해 작동하는 것을 허용하지 않기 때문에 이메일을 보내고 있었다. (필자의 경우에는 작업 스케줄러에서).

필자는 프로그램이 아닌 서비스로 실행 중이기 때문에 스크립트를 생성하고 몇 시간마다 명령을 실행 했으므로 제대로 작동합니다. 단점은 내 스크립트에서 호출되는 절전 호출입니다.

0

마이크로 소프트의 manual이 제공합니다 :

Cause: If many COM+ applications run under different user accounts that are specified in the This User property, the computer cannot allocate memory to create a new desktop heap for the new user. Therefore, the process cannot start.

WORKAROUND: To work around this problem, modify the value of the following registry subkey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems\Windows

+0

값을 무엇으로 변경합니까? –

+0

매뉴얼을 읽으십시오, 그것에서 지정합니다 –

+0

매뉴얼은 sharedsection에 512를 추가하도록 지시하지만 현재 값은 다음과 같습니다 : SharedSection = 1024,20480,768 –

0

전망은 싱글 톤 - COM 시스템 호출을 마샬링을 거부합니다 서로 다른 보안 컨텍스트에서 실행되는 두 프로세스 사이.

+0

어떻게 작동 시키는가? 어떤 제안? –

+0

서비스 (예 : 작업 스케줄러)에서 Outlook을 사용할 수 없습니다. Outlook Object Model을 사용하고 있고 Outlook이 이미 실행중인 경우 실제로 수행 할 수있는 작업이 없습니다. –

+0

이 작업을 시도했지만 작동하지 않습니다. System.Diagnostics.Process [] processes = System.Diagnostics.Process.GetProcessesByName ("OUTLOOK"); int collCount = processes.Length; 응용 프로그램; if (collCount! = 0) app = 응용 프로그램으로 Marshal.GetActiveObject ("Outlook.Application"); else app = new Microsoft.Office.Interop.Outlook.Application(); 예외가 수정되었지만 전자 메일은 보내지지 않습니다. –

관련 문제