BookmarkSubscribeRSS Feed
Calcite | Level 5

I am trying to build a solution that involves connecting to our Metadata server hosted on an AWS Red Hat instance through C# .NET, and am using Chris Hemedinger's C# example for .NET as an example. When I try to run the code, I immediately get a COMException from OMRInterface. Usually this results in a message of 

"Could not connect: <connectionAttempts></connectionAttempts>"


System.Runtime.InteropServices.COMException (0x80042002): <connectionAttempts></connectionAttempts>
   at SASObjectManager.ObjectFactoryMulti2Class.CreateObjectByServer(String Name, Boolean synchronous, ServerDef pIServerDef, String LoginName, String Password)
   at SAS.BI.Itconfig.Library.ServerTests.SASServerTest.CreateConnectionWithObjectFactoryMulti()
   at SAS.BI.Itconfig.Library.ServerTests.SASServerTest.CreateConnection()

I have installed the SAS Integration Technologies Client, and have tried using the ITConfig.exe to test the connection, and will get this message every time

Function Name:CreateObjectByServer
0x80042002 - <connectionAttempts>
<description>Invalid pointer
<sasmachinednsname>[machine DNS name here]</sasmachinednsname>
There is no additional error information available.

It does not matter what Machine DNS name I use, or whether or not I use a username and password when testing the IOM Bridge to our Metadata Server. I have run other tests to check that I do have access to the port, so that shouldn't be the issue. I think the issue is on my machine. I think it has something to do with the initial creation of 

SASObjectManager.IObjectFactory2 obObjectFactory = new SASObjectManager.ObjectFactoryMulti2();

As this results in an OMRInterface exception. I have also tried connecting to Workspace instead (port 8591), but get the exact same error.


Does anyone have an idea of what the Invalid Pointer in the error message is referring to? Are there other SAS libraries/programs/clients I need to install besides Integration Technologies Client?

Barite | Level 11
I am not at my machine right so winging it a bit. Check your dcom config for permissions.
Calcite | Level 5

Thanks for the quick response! In the ITConfig, it says

An error occurred while trying to gather information about SAS. SAS may not be installed on this machine.
DCOM is enabled. dcomcnfg Settings: Default Authentication Level: Not Specified Default Impersonation Level: Identify

The first part, I've been assuming it's because I don't have any SAS programs aside from the ITClient.

I also checked my DCOM permissions, and there doesn't seem to be anything wrong there. Although I have never played around with those kinds of settings before, so not sure what to do.

Barite | Level 11

I believe you are hitting a security issue, but that is the case in almost all circumstances with the IntTech connection. I know this is old (26056 - Microsoft Visual Studio 2005 C# Code Snippets ( but look at the IOM section and see if that helps you isolate the wrong parm. The CLSID is the best search term, not the error. You may need to call tech support or see if Chris picks up on it.


I never use IOM. I tend to put a web service on the server and call into SAS that way. Much, much easier.


It depends on what you need to do as well. If the goal is to submit code or read a dataset.
Barite | Level 11

I found some old code. I am sending a few snippets which you can piece together:


       internal static SAS.Workspace ConnectToSAS()
            SASObjectManager.ObjectFactoryClass objFactory = new SASObjectManager.ObjectFactoryClass();
            SASObjectManager.ServerDefClass serverDef = new SASObjectManager.ServerDefClass();
            // ************************************************
            // Configure the SAS server information.
            // ************************************************
            serverDef.BridgeEncryptionAlgorithm = "SASProprietary";
            serverDef.BridgeEncryptionLevel = SASObjectManager.EncryptionLevels.EncryptUserAndPassword;
            serverDef.MachineDNSName = "client.dnsexample.local";
            serverDef.MachineDNSName = "";
            serverDef.MachineDNSName = "skycutter";
            serverDef.Port = 8592;
            serverDef.Port = 8591;
            serverDef.Protocol = SASObjectManager.Protocols.ProtocolBridge;
            // ************************************************
            // Create the connection.
            // ************************************************
            SAS.Workspace sasWorkspace = null;
            sasWorkspace = (SAS.Workspace)objFactory.CreateObjectByServer("BridgeConnection", true,
                serverDef, "uid", "password");
            // Add the SAS object to the ObjectKeeper. If the object is not
            // in the ObjectKeeper, it cannot be used by the IOM Data Provider.
            SASObjectManager.ObjectKeeperClass objKeeper = new SASObjectManager.ObjectKeeperClass();
            objKeeper.AddObject(1, "BridgeConnection", sasWorkspace);
            return sasWorkspace;
            // objKeeper.RemoveObject(sasWorkspace);
        } // connectToSAS()

        /// <summary>
        ///     Submits SAS code using the IOM interface
        /// </summary>
        /// <param name="sasCode">The SAS statements to be submitted</param>
        public SasRunObject SubmitSasCode(string sasCode)
                Workspace ws = CreateWorkspace();
                SasCore.StepError = false;
                SasCore.SasLanguageService = ws.LanguageService;
                SasCore.SasLanguageService.StepError += SasLanguageService_StepError;
                SasCore.SasLanguageService.LineSeparator = "\r\n";
                var sro = new SasRunObject();
                sro.SasCode = sasCode;
                sro.SasLog = SasCore.SasLanguageService.FlushLog(SasCore.LogCharactersToReturn);
                sro.SasList = SasCore.SasLanguageService.FlushList(SasCore.ListCharactersToReturn).Replace("\f", "");
                return sro;
            catch (Exception ex)
                util.HandleError(MethodBase.GetCurrentMethod().Name, ex);
                return null;
Calcite | Level 5

I tried the code you attached and was getting the same problem. We're thinking it's likely a security issue, especially since I am working on a company computer. We will be trying out other solutions, and contact tech support if we get stuck with those as well. Your help is much appreciated!

Barite | Level 11
Make sure you go into dcomcnfg utility in Windows and, on any SAS objects, set Permissions to None. That may help. When I looked, I didnt see any SAS objects in my DCOM which is strange. They used to always be there. Check yours and good luck.

Fiddler may help you as would sysmon in the SysInternals suite.
Calcite | Level 5

Wanted to update this now that I have solved the issue.

I googled the SAS Integration Technologies Client, and the first several hits were for SAS 9.2. I have now gotten a link from SAS to the newest version, and am able to connect to the server remotely.



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2 in conversation