One of the most often-asked questions we receive is “I want to add my custom DLLs into a separate folder instead of the instance folders root; how do I do that?” A DLL is a method to encapsulate logic for re-use. In many cases, you may have existing logic in a DLL or rather than having large amounts of code in a Business Process Step, you may elect to host your code in a DLL. In this blog post, I’m going to address that question in detail. For purposes of this post, we’ll assume we are working with a 64 bit instance named DEFAULT. To understand where to make the necessary changes, you have to first understand how the various Neuron ESB EXE’s are configured.
The main reason you would want to host your DLLs in a custom folder is to make deployments easier. Otherwise, you need to host your DLLs in the instance root (along with all of the DLLs Neuron ESB requires) or the Global Assembly Cache (GAC). For the record, our recommended guidance is to avoid using the GAC!
Under the instance root, you will find 6 configuration files:
- esbhost.exe.config: App Config for Workflow hosting environment
- esbService.exe.config: App Config for the core Neuron ESB service
- exportConfig.exe.config: App Config for Neuron ESB’s solution export feature
- importConfig.exe.config: App Config for Neuron ESB’s solution import feature
- NeuronExplorer.exe.config: App Config for the Neuron ESB Explorer Application
- NeuronTestClient.exe.config: App Config for the Neuron ESB Test Client Application
You may be wondering “Why so many configuration files?” Neuron ESB is more than just the core service. The suite is a confederation of several applications. The two we work with most directly, the Neuron ESB Explorer and Test Client are themselves .NET Applications. Consequently, they have their own App Config files. Configuration files in .NET, whether they are Web Config files for ASP applications or App Config files for Console, Windows Forms, Class Library, WPF App, etc determine certain behaviors and characteristics for the given .NET application. The Neuron ESB EXE’s are no different.
Assuming a standard/default installation, the configuration files enumerated above will be found in the following directory:
C:Program FilesNeudesicNeuron ESB v3DEFAULT
I can point directly to and reference my DLLs in a business process, why do I need to modify a configuration file?
While it is true that in the Business Process Designer in the Neuron ESB Explorer you can point to a DLL that resides anywhere on your machine or the network, that doesn’t mean the Neuron ESB service will automatically know where to find your DLL. The following graphic illustrates how to reference a DLL in the Business Process Designer:
When it comes to interactively testing your process, your DLL will be found. This behavior however is different when the Neuron ESB Service or a client invokes that same business process. Essentially, the difference is between design time and run time behavior. For the run time to work correctly, the configurations must contain the necessary data for your solution to work correctly.
Next, we’ll open the esbService.exe.config file to show where to make the necessary modifications to make Neuron ESB aware of your custom folder for your custom DLLs. The following graphic illustrates the item we need to modify: the privatePath value for the probing node.
By default, there are two values:
- Connectors: The connectors folder under the instance root. This folder hosts all of the Connector DLLs
- Pipelines: This folder hosts the DLLs for your custom business process steps
Every other DLL Neuron ESB requires is hosted in the instance’s root folder.
Specifying a Custom Folder for your Custom DLLs
Let’s assume you wish to create a folder named CustomLibraries under the instance root and that is the place you wish to host your custom DLLs:
For the run time to work correctly, at a minimum, you need to modify the esbService.exe.config file as follows:
Is your work finished? No!
Most likely, you’ll want to use Test Clients to test your solution. Therefore, you also need to also modify the neuronTestClient.exe.config.
You will also need to modify the neuronExplorer.exe.config if you have business processes calling other business processes via the Execute Process Step.
For the privatePath setting, keep all 3 configurations in sync.
What if I’m using the Client API?
The guidance is the same. Remember the context your solutions runs. If you connect to Neuron ESB via a Client Connector, your solution runs in the context of the Neuron ESB Service on the server. On the other hand, if you have embedded the Neuron ESB Client API into your application, then your solution will run in the context of the machine that is hosting your application. The Neuron ESB Test Client is that kind of application. That’s why it has its own App Config file. In Client API cases, you also need to distribute your custom DLLs as well as the core Neuron DLLs.