Failed to create COM objects on AX 4 AOS

You may come across this issue when attempt to initialize a COM object on AX 4 AOS server side:
 
static server void ActivateCOMOnAOS()
{
    #define.Word(‘Word.Application’)
    COM com;
    InteropPermission permission = new InteropPermission(InteropKind::ComInterop);
    ;
 
    permission.assert();
    //BP deviation documented
    com = new COM(#Word);
    CodeAccessPermission::revertAssert();
}
And an error message will appear:
COM object of class ‘Word.Application’ could not be created. Ensure that the object has been properly registered on computer ‘ComputerName’.
 
It is because by default, Microsoft Word as a COM object can not be launched by the user NT AUTHORITYNETWORK SERVICE. 
 
The way to resolve this issue is to modify the Activation permission for Word Application using the Component Services administrative tool.
 
Configure DCOM (Windows 2003)
  • Start -> All programs -> Administrative Tools -> Component Services.
  • Expand Component Services
  • Expand Computers
  • Expand My Computer
  • Select the DCOM Config item
  • Select the Microsoft Word Document item.
  • Right click and select Properties
  • Under Launch and Activation Permissions select the Customize option.
  • Click the Edit button
  • Click the Add button to add a new account to the list.
  • Click the OK button
  • On the dialog that is displayed enter Network Service as the account name.
  • Grant Network Service the launch and activate permission.
Advertisements
This entry was posted in Axapta Development. Bookmark the permalink.

One Response to Failed to create COM objects on AX 4 AOS

  1. 小西 says:

    T_T 走过来瞧瞧~~~~

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s