BookmarkSubscribeRSS Feed
meiacopeland
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>"

and

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>
<connectionAttempt>
<description>Invalid pointer
</description>
<status>0x80004003</status>
<saslogin></saslogin>
<sasmachinednsname>[machine DNS name here]</sasmachinednsname>
<sasport>8561</sasport>
<sasclassid>2887E7D7-4780-11D4-879F-00C04F38F0DB</sasclassid>
<threadid>31556</threadid>
</connectionAttempt>
</connectionAttempts>
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?

7 REPLIES 7
AlanC
Barite | Level 11
I am not at my machine right so winging it a bit. Check your dcom config for permissions.
https://github.com/savian-net
meiacopeland
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.

AlanC
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 (sas.com)) 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.

https://github.com/savian-net
AlanC
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 = "172.88.111.22";
            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)
        {
            try
            {
                Workspace ws = CreateWorkspace();
                SasCore.StepError = false;
                SasCore.SasLanguageService.Reset();
                SasCore.SasLanguageService = ws.LanguageService;
                SasCore.SasLanguageService.Submit(sasCode);
                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;
            }
        }
https://github.com/savian-net
meiacopeland
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!

AlanC
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.
https://github.com/savian-net
meiacopeland
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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1066 views
  • 0 likes
  • 2 in conversation