2015年6月3日 星期三

[C#/Excel PIA] Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a The server process could not be started because the configured identity is incorrect. Check the username and password.

說明:
使用Excel PIA寫schedule job產出Excel,程式放在64 bits server上,執行出現該錯誤。


解法:
出現此錯誤,主要是COM元件的存取帳戶被設為Interactive,
因此程式執行時,需要有帳戶登入該server。看過網路上的解法,
打開Administrative Tools下的component service -> Computers -> DCOM Config,
找到Microsoft Excel Application或{00024500-0000-0000-C000-000000000046},
右鍵Properties,找到Security tab或identity tab,將帳戶加進去,
但我找不到Excel Application,試過在command line下mmc comexp.msc /32等方法,還是沒顯示,最後是在登錄檔,HKEY_CLASSES_ROOT\AppID\{00020812-0000-0000-C000-000000000046},將某個屬性值的Interactive改掉即可。


參考資料:
https://ovaismehboob.wordpress.com/2013/07/06/production-deployment-issues-when-asp-net-web-application-access-com-component/
http://blogs.technet.com/b/the_microsoft_excel_support_team_blog/archive/2012/11/12/microsoft-excel-does-not-appear-in-dcom-configuration-snap-in.aspx
https://msdn.microsoft.com/en-us/library/ms678426(VS.85).aspx
http://www.cnblogs.com/fengjunkuan/

沒有留言:

張貼留言