Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET APP As Windows Services - Call to Excel or Word failing.

Status
Not open for further replies.

vinidel

IS-IT--Management
Jan 23, 2004
78
US
Hi ALL,

I have a small application APP A that converts excel and doc files to text files. I have another application APP B that is running as services on my windows server.

Within APP B I have a call to APP A and I am passing the source filename and path to APP A to convert these files to text files.

Now I am able to debug the process and these are my findings and issues:
Findings:
1. App A is getting the correct source file name and path name.
2. App A is calling the right converter method to convert the excel or word file.
3. I can see in the Processes tab of windows task manager that Excel.exe or Winword.exe getting started when my App B makes the call to App A.

Issue:
1. The exception I am getting is "server execution failed". Even though I have the Excel.exe or WinWord.exe running in the processes of Windows Task Manager, something is not allowing App A to carry on with the conversion process.

NOTE: The conversion process actually opens EXCEL or WORD application with visible property - FALSE and use their SaveAS method to convert the files to text file.

Also when I run APP A from dos prompt and pass the source file name with path it run succesfully and converts the excel or doc file to text file.

I hope I am clear enough with my problem. I would really apprecite if someone can help or give any suggestions.

Thanks
 
MS-Office applications were never designed to be run as service applications. It is possible, but you'll run into licensing issues (everyone that you do this for must own a license for Excel/Word/etc)

Also, MS-Office applications are designed to be run by the logged-on user on their desktop. Service applications don't have a desktop, and aren't technically "logged-in" (they have security rights & priviledges, but aren't really logged in as a user would be).

And.. Server applications are typically designed to respond to multiple requests simultaneously via threading, async calls, etc. Excel/Word/etc. are single-threaded, so you must make sure to serialize your access to them.

If you still want to try this, be aware that Excel in particular will create objects on your behalf that must be set to Nothing before you set your instance of the Application object to Nothing. Do a search, this has been covered many times.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
These warnings & cautions in the KB article alone would be enough to persuade me to find another way to accomplish what I want. There are vendors who sell libraries that allow you to create MS-Word and MS-Excel documents without needing those products installed.

Chip H.

mskb said:
Caution: Automation of any Office application from an unattended, non-interactive user account is risky and unstable. A single error in code or configuration can result in a dialog box that can cause the client process to stop responding (hang), that can corrupt data, or that can even crash the calling process (which can bring down your Web server if the client is ASP).

Warning: Office was not designed, and is not safe, for unattended execution on a server. Developers who use Office in this manner do so at their own risk.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top