by degiocuondi.com
12. August 2010 12:26
Lại nữa, cái service chạy đến đoạn new LogQueryClassClass(); thì nó lại đứng một chỗ, nó không thể tạo một thực thể LogQueryClassClass
try
{
LogParser = new LogQueryClassClass();
W3Clog = new COMW3CInputContextClassClass();
Phải debug, thêm đoạn:
catch (COMException ex)
{
Utils.Log(ex.Message);
}
để xem báo lỗi: Retrieving the COM class factory for component with CLSID {...} failed due to the following error: 80070005.
Lại hỏi google, thì ra là nó thiếu quyền, lại phải cấu hình phân quyền DCOM
+ Vào Start\Run gõ DCOMCNFG enter ==> Mở "Component Services" MMC
+ Duyệt tới Component Services\Computers\My Computer\DCOM Config\MSUtil, right click chọn Properties
+ Vào Security Tab\Launch and Activation Permission\Customize bấm Edit
+ Add user thực thi của service add vào, tui add vô luôn user Administrator
+ Check vào 2 mục: Local Launch, Local Activation cho user đó. OK
+ Restart service
Nói thêm, để parse log IIS tôi cài thêm free tool tên là Log Parser của MS, phải reference LogParser.dll vào project nên mới phải Configure DCOM.
==> Chạy ngon lành
Cảm ơn crowe.co.nz!
Cảm ơn google!