I can't start the Word object

G

ghostnguyen

Hi all,

In my aspx page, I initial the Word object like this:

- Microsoft.Office.Interop.Word.ApplicationClass app = new
ApplicationClass();

but the IIS response "Access is denied".

I appreciate any response.
 
G

Gabriel Lozano-Morán

That's because the IIS account does not have permissions to launch the Word
application.

On the server running IIS:

1. Start -> Run dcomcnfg.exe
2. Expand Component Services
3. Expand Computers
4. Expand My Computer
5. Expand DCOM config
6. Select Microsoft Word Document
7. Right-click and select properties
8. Click on the security tab
9. Under Launch and Activation permissions select Customize and click on
Edit
10. Add the following users ASPNET, IUSR_<machinename>, IWAM_<machinename>
and NETWORK SERVICE if IIS running on Win2K3

Gabriel Lozano-Morán
Software Engineer
Sogeti
 
G

ghostnguyen

Thanks for your intruction.

I can initial WordApp object but I can't initial WordFile object. This's my
code:

Microsoft.Office.Interop.Word.ApplicationClass app = new ApplicationClass();
// Ok
Microsoft.Office.Interop.Word.Document doc = new DocumentClass(); //Fail

Exception Details: System.Runtime.InteropServices.COMException: Server
execution failed.

In addition, is it a good idea if I apply Word automation in Webpage?
 
L

LOZANO-MORÁN, Gabriel

Microsoft.Office.Interop.Word.Document doc = new DocumentClass(); //Fail
Exception Details: System.Runtime.InteropServices.COMException: Server
execution failed.

You need to perform the same steps as for the Microsoft Word Application but
now for the Microsoft Word Document
In addition, is it a good idea if I apply Word automation in Webpage?

That depends on the project you are working on and on what you are trying to
establish. But I would consider putting these things in a seperate .NET
assembly. Doing so you don't need to give the IIS user accounts permissions
for Word application and you make your application more scalable.

Gabriel Lozano-Morán
 
G

ghostnguyen

Hi

In DCOM Config, I see only the "Microsoft Word Document". There is no
"Microsoft Word Application".
My machine installed Office 2003.

As I understand your idea, I think if I create an assembly A that operates
with Office and my WebApp calls A. A still runs under "NET SERVICE" account
and gives the same problem.

Ghost Nguyen
 
G

Gabriel Lozano-Morán

You could use impersonation in the seperate assembly

Gabriel Lozano-Morán
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top