When using the RfcDestination.Repository.CreateFunction method the SAP .NET Connector 3 will read all necessary metadata information from the SAP server represented by the RfcDestination. That metadata information is cached in the repository for future calls (in the CachedAbapObjectMetadata, CachedFunctionMetadata, CachedStructureMetadata and CachedTableMetadata fields of the RfcRepository class). This works well except when using the SAP .NET Connector 3 in a web application hosted in IIS because objects in memory will be lost when IIS recycles the application, which in turn will result in all cached metadata being lost.
Re-reading the meta data for every RFC call has caused some instability since the SAP server and IIS server aren't co-located and are connected over the Internet. We'd like to read the metadata from the server once during the setup of the application, store it, then manually add metadata to a repository, but if we add a RfcFunctionMetadata object to the CachedFunctionMetadata collection of a RfcRepository it doesn't do anything, the CachedFunctionMetadata remains empty.
In the NCO 3 Programming Guide there is a short section "Working with Hard-Coded Metadata" which explains that a custom repository is required and that a destination can be assigned to a custom repository to allow any missing meta data to be looked up normally. Is this the only way to achieve persistent caching of meta data? If so where would one get some example code, as the document doesn't provide any?
Ultimately, what I am looking for is a solution to a co-located environment. The web application is designed to work with most versions of SAP, multiple destinations, and to be used on a daily basis. The requirement is to reduce the number of calls between the web server and the SAP servers in order to improve on stability of the application and reduce the bandwidth requirements.
Currently the application works fine, but sometimes gives errors such as "Function module "RFC_METADATA_GET" not found", or the incorrect metadata is returned and the application goes into error because of missing metadata. The only thing that we can pinpoint these random errors to is the massive amounts of metadata calls...
Any help would be appreciated