When I run the following code from Visual Studio, (debug) from my aspx page, everything works out as planned, but when I publish the site, the WINWORD.EXE process starts on the server and nothing else happens. I want to use this COM interop
to find and replace certain fields in this word document, and then print to pdf.
You might need to give the ASP.Net worker process user rights to interact with the desktop. I experienced a similar problem with a different product that worked fine locally because it ran under my privileges and choked once deployed.
You should be able to replicate the problem locally by setting up your app in IIS on your machine and then you can test the solution to see if it works for you.
I've heard of it being done (and it sounds like it's working for you locally), but I've not used Word itself. I've used other components that had similar rights issues, but I was able to replicate and troubleshoot the error on my local machine by accessing
the app via IIS (not VisualStudio's web server).
Warren DuBoi...
0 Points
2 Posts
using Microsoft.Office.Interop.Word on ASP.NET server starts process, but hangs
Apr 25, 2008 08:29 PM|LINK
When I run the following code from Visual Studio, (debug) from my aspx page, everything works out as planned, but when I publish the site, the WINWORD.EXE process starts on the server and nothing else happens. I want to use this COM interop to find and replace certain fields in this word document, and then print to pdf.
PLEASE HELP!!!
object filename = Worddoc; object readOnly = false; object isVisible = true; object missing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.ApplicationClass wordapp = new Microsoft.Office.Interop.Word.ApplicationClass();wordapp.Visible =
true; Microsoft.Office.Interop.Word.Document oWordDoc = wordapp.Documents.Open(ref filename, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing); int x = 0;oWordDoc.Activate();
foreach (String fnd in Find){
object find = fnd; object replace = Replace[x]; object reptrue = true; //do find wordapp.Selection.Find.Execute(ref find, ref reptrue, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref replace, ref reptrue, ref missing,ref missing, ref missing, ref missing);x++;
}
Thanks in advance!
stiletto
All-Star
16995 Points
3304 Posts
Re: using Microsoft.Office.Interop.Word on ASP.NET server starts process, but hangs
Apr 26, 2008 02:34 AM|LINK
You might need to give the ASP.Net worker process user rights to interact with the desktop. I experienced a similar problem with a different product that worked fine locally because it ran under my privileges and choked once deployed.
You should be able to replicate the problem locally by setting up your app in IIS on your machine and then you can test the solution to see if it works for you.
carlos.abdal...
Member
6 Points
3 Posts
Re: using Microsoft.Office.Interop.Word on ASP.NET server starts process, but hangs
Apr 28, 2008 12:33 PM|LINK
Hi!!!
Tks for ur info... but on client and server the ASPNET user is Member of Administrator´s Group..
BRDs...
stiletto
All-Star
16995 Points
3304 Posts
Re: using Microsoft.Office.Interop.Word on ASP.NET server starts process, but hangs
Apr 29, 2008 01:03 AM|LINK
Did you try replicating the issue through your local IIS?
carlos.abdal...
Member
6 Points
3 Posts
Re: using Microsoft.Office.Interop.Word on ASP.NET server starts process, but hangs
Apr 29, 2008 11:51 AM|LINK
I try this scenary on local machine on local iis....
Can you open the word interface on webapp ?
tks
stiletto
All-Star
16995 Points
3304 Posts
Re: using Microsoft.Office.Interop.Word on ASP.NET server starts process, but hangs
Apr 29, 2008 02:26 PM|LINK
I've heard of it being done (and it sounds like it's working for you locally), but I've not used Word itself. I've used other components that had similar rights issues, but I was able to replicate and troubleshoot the error on my local machine by accessing the app via IIS (not VisualStudio's web server).
carlos.abdal...
Member
6 Points
3 Posts
Re: using Microsoft.Office.Interop.Word on ASP.NET server starts process, but hangs
Apr 29, 2008 02:37 PM|LINK
R u Brazilian ?
Pls can u post some code for example ?
I try this example ( http://forums.asp.net/t/1068814.aspx ) but don´t work well..
Tks guy!