I see you are using MSWord Interop. This generally creates more headaches. Honestly, you may be better off using a third-party component that does this instead of having MSWord installed on your web server. I'll look around and see if I can dig up something.
Thanks bbcompent1 for the post but my code is working fine on the local machine but when i upload my application on my server it given me the error that i have posted on my earlier post.
One more thing to check out is does your application identity have full control on the machine? I think in order for this to work, the user will need higher level permissions than the IIS User account. Maybe enabling full trust in your web.config might do
it. The theory is when you run locally, you are running under your user account with full privileges on your development desktop. When you promote to PROD, you are running under the anonymous web account which has very limited permissions.
Er. Gursewak...
Member
65 Points
47 Posts
Convert word file into HTML in C# 3.5 is not working on server
Nov 19, 2012 12:29 PM|LINK
Hi Guys,
I downloaded the code that convert word file to HTML file. The code is working fine on my local machines but not working on the server.
And I get the error "Exception Details: System.Runtime.InteropServices.COMException: This command is not available because no document is open."
Error in that line :
Er. Gursewak Singh
S/w Engineer
bbcompent1
All-Star
33097 Points
8529 Posts
Moderator
Re: Convert word file into HTML in C# 3.5 is not working on server
Nov 21, 2012 12:21 PM|LINK
I see you are using MSWord Interop. This generally creates more headaches. Honestly, you may be better off using a third-party component that does this instead of having MSWord installed on your web server. I'll look around and see if I can dig up something.
bbcompent1
All-Star
33097 Points
8529 Posts
Moderator
Re: Convert word file into HTML in C# 3.5 is not working on server
Nov 21, 2012 12:25 PM|LINK
For now, compare your code and processes with what is in this how-to:
http://www.c-sharpcorner.com/uploadfile/suthish_nair/convert-microsoft-office-word-to-other-formats-pdf-html-rtf-xps/
bbcompent1
All-Star
33097 Points
8529 Posts
Moderator
Re: Convert word file into HTML in C# 3.5 is not working on server
Nov 21, 2012 12:31 PM|LINK
Here's another thread from the forums here: http://forums.asp.net/t/1606331.aspx
Er. Gursewak...
Member
65 Points
47 Posts
Re: Convert word file into HTML in C# 3.5 is not working on server
Nov 22, 2012 05:52 AM|LINK
Thanks bbcompent1 for the post but my code is working fine on the local machine but when i upload my application on my server it given me the error that i have posted on my earlier post.
Please dear please help me out. Its working fine.
Er. Gursewak Singh
S/w Engineer
bbcompent1
All-Star
33097 Points
8529 Posts
Moderator
Re: Convert word file into HTML in C# 3.5 is not working on server
Nov 23, 2012 11:49 AM|LINK
For interop to work on the server, you have to install MS Word on the web server.
Er. Gursewak...
Member
65 Points
47 Posts
Re: Convert word file into HTML in C# 3.5 is not working on server
Nov 23, 2012 11:52 AM|LINK
I already Installed it on the server.
But getting the same error.
Actually i just have installed the Framework of 3.5 on server not whole .NET...
May it also be the reason ?????
Er. Gursewak Singh
S/w Engineer
TracyLandy
Member
46 Points
13 Posts
Re: Convert word file into HTML in C# 3.5 is not working on server
Nov 26, 2012 02:14 AM|LINK
http://janewdaisy.wordpress.com/2012/04/06/how-to-convert-word-document-to-html-with-cvb-net/
Method in this post may give you some suggestion.
thava
Member
53 Points
24 Posts
Re: Convert word file into HTML in C# 3.5 is not working on server
Nov 26, 2012 02:24 AM|LINK
Hi
Try this...
Document doc = WordApp.Documents.Open(sFromName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
doc.SaveAs(sToName,ref fileFormat, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
bbcompent1
All-Star
33097 Points
8529 Posts
Moderator
Re: Convert word file into HTML in C# 3.5 is not working on server
Nov 26, 2012 10:56 AM|LINK
One more thing to check out is does your application identity have full control on the machine? I think in order for this to work, the user will need higher level permissions than the IIS User account. Maybe enabling full trust in your web.config might do it. The theory is when you run locally, you are running under your user account with full privileges on your development desktop. When you promote to PROD, you are running under the anonymous web account which has very limited permissions.