From: ritesh.singhal on
Hi,

I am trying to do server side office automation. I have a word template
which I am trying to populate with data from SQL server but when I try
to generate the Word document I get following error:

Unable to cast COM object of type 'Word.ApplicationClass' to interface
type 'Word._Application'. This operation failed because the
QueryInterface call on the COM component for the interface with IID
'{00020970-0000-0000-C000-000000000046}' failed due to the following
error: Library not registered. (Exception from HRESULT: 0x8002801D
(TYPE_E_LIBNOTREGISTERED)).
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Unable to cast COM
object of type 'Word.ApplicationClass' to interface type
'Word._Application'. This operation failed because the QueryInterface
call on the COM component for the interface with IID
'{00020970-0000-0000-C000-000000000046}' failed due to the following
error: Library not registered. (Exception from HRESULT: 0x8002801D
(TYPE_E_LIBNOTREGISTERED)).

This works fine on my test machine, but when I try to run the same
application on my production server I get above error. Please help if
you have any idea.

Thanks in advance.

Ritesh