cancel
Showing results for 
Search instead for 
Did you mean: 

NCo 3 method to unregister destination connection

bryan_lanning2
Explorer
0 Kudos
703

Question: How do I release/unregister/delete/destroy a connection created by the RfcDestinationManager.GetDestination(RfcConfigParameters) function call?

I use the SAP NCo 3 inside of a Visual Studio WCF project hosted in IIS.  We wanted each user's actions to be recorded as themselves inside of SAP, so we avoided using the RfcDestinationManager.RegisterDestinationConfiguration function.  Instead we're using the GetDestination function so we can pass the RfcConfigParameters (including the user's name and password).  That part works fine.  We can even reuse the destination by using the TryGetDestination function so they don't need to wait while it reauthenticates.  What I'm having a problem with is that it appears there's no way to explicitly close/release the destination in a manner similar to the RfcDestinationManager.UnregisterDestinationConfiguration.  We can use the RfcDestinationMonitor to list all the destinations that have been created along with the destination name (which in our implementation also includes the user's name) and the LastActivityTimestamp, but we need a way to close some or all of the connections if needed.  We can stop/restart the web site and IIS Application Pool, but that would affect all of our users and feels very heavy-handed.

View Entire Topic
MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Bryan,

you don't have to take care for releasing the connection. This happens automatically within NCo runtime. By setting the destination parameter RfcConfigParameters.ConnectionIdleTimeout (IDLE_TIMEOUT when using app.config) how long a connection is kept open for re-use before being closed. With RfcConfigParameters.IdleCheckTime you can control how often this is checked for the destination.

Actually, for what you want to achieve the simpler approach is to register a IDestinationConfiguration, configure a single destination containing repository user and password. For each user you can then create an RfcCustomDestination, for which you set the logon credentials. Thus, NCo runtime is also taking care of invalidating outdated connections when the configuration of the parent destination changes.

Best regards,

Markus

bryan_lanning2
Explorer
0 Kudos

Thanks for the answer and the additional tip about using RfcCustomdestinations!