I can't start the Word object

Discussion in 'ASP .Net Security' started by ghostnguyen, Apr 25, 2005.

  1. ghostnguyen

    ghostnguyen Guest

    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.
    ghostnguyen, Apr 25, 2005
    #1
    1. Advertising

  2. 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
    Gabriel Lozano-Morán, Apr 25, 2005
    #2
    1. Advertising

  3. ghostnguyen

    ghostnguyen Guest

    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?



    "Gabriel Lozano-Morán" <> wrote in message
    news:...
    > 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
    >
    ghostnguyen, Apr 25, 2005
    #3
  4. > 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
    LOZANO-MORÁN, Gabriel, Apr 25, 2005
    #4
  5. ghostnguyen

    ghostnguyen Guest

    Hi

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

    >> But I would consider putting these things in a seperate .NET assembly


    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


    "LOZANO-MORÁN, Gabriel" <> wrote in message
    news:...
    >> 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
    >
    >
    ghostnguyen, Apr 27, 2005
    #5
  6. You could use impersonation in the seperate assembly

    Gabriel Lozano-Morán

    "ghostnguyen" <> wrote in message
    news:es$...
    > Hi
    >
    > In DCOM Config, I see only the "Microsoft Word Document". There is no
    > "Microsoft Word Application".
    > My machine installed Office 2003.
    >
    >>> But I would consider putting these things in a seperate .NET assembly

    >
    > 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
    >
    >
    > "LOZANO-MORÁN, Gabriel" <> wrote in message
    > news:...
    >>> 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
    >>
    >>

    >
    >
    Gabriel Lozano-Morán, Apr 27, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luis Esteban Valencia
    Replies:
    2
    Views:
    2,940
    sanjupillai
    Sep 26, 2008
  2. srk
    Replies:
    0
    Views:
    637
  3. srk
    Replies:
    0
    Views:
    607
  4. Shea Martin
    Replies:
    1
    Views:
    169
    Rodrigo Bermejo
    Jan 15, 2007
  5. Guest
    Replies:
    4
    Views:
    294
    Guest
    May 12, 2006
Loading...

Share This Page