?
Solved

Creating Microsoft Word Object in Thread Fails on Deployed Workstation

Posted on 2011-10-06
4
Medium Priority
?
424 Views
Last Modified: 2012-06-27
I am running some office automation in a thread.  This works on my development machines, but fails when deployed.  If I run the same code outside of a thread, it works on all machines.  Does anyone have any ideas?  I became so frustrated that I created the most basic non-class driven automation to make sure I wasn't going crazy:

Attached are two files, same program but one calling via thread the other direct.

 Works.txt

 Fails.txt
0
Comment
Question by:DuBoisCG
  • 2
  • 2
4 Comments
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 36929110
The first reason that comes to my mind in such a scenario when something works on development machine and not on deployment machine is the permissions of user under whose credentials the code/application is running under

generally on dev machines we always have admin rights and when we deploy the user credentials the application is using is generally restricted
0
 
LVL 2

Author Comment

by:DuBoisCG
ID: 36929725
It's a good thought, but the working test (same code, just not in a thread) runs as the local user.

I actually got it working by adding the office.dll into the working directory, but want to leave this issue open to see if anyone can explain why this dll wasn't required for the working test.  If there are some important rules for threads that limit their ability to access resources, it would be nice to document it here (couldn't find much threaded function help).
0
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 2000 total points
ID: 36929797
logged in users normally have higher permissions as they can create files etc on the PC when logged on.
Office.Dll should have been there in your working directory (in the references you might have not selected copy local for the reference) thats why its missing when you deploy it
It will work perfectly well on development because it knows from which path the reference has been added but on deployment machine the local copy is needed to make it run. Thats my observation and adding more i dont think that there are any specific rules for threads as a normal execution exe
0
 
LVL 2

Author Closing Comment

by:DuBoisCG
ID: 36929810
We still don't know why the same code would run outside a thread on the same machine as the same user... but ultimately it needed the referenced dll in the working directory in order for the thread version to run.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Suggested Courses
Course of the Month17 days, 10 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question