2
Answers

MVC file reading in c#

hi,
 
 am using mvc 4 application. and iam working in mail merge consept in my project. so i done the mail merge coding part in my project then its working in local system only. and i publish the application and hoste to server. i can not read the .doc file in that server side.
 
am using Mircosoft.Office.Interop.word.dll
 
this dll was not working in server. 
 
See this my code :
 
Object oMissing = System.Reflection.Missing.Value;
Object oTemplatePath = "F:\\test_bk\\TestTemplate.doc";
//Object oTemplatePath = "D:\\TestTemplate.doc";
Microsoft.Office.Interop.Word.Application wordApp = new Application();
Document wordDoc = new Document();
wordDoc = wordApp.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);
 
 
Server: windows 2008 r2
 
 
 see the below error

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
 
This the error am getting when i testing in server.
any solution
 
Thank you,
Bharat peggem 
 
Answers (2)