Does anyone have a VB.Net example code that would replace the "App.config" file so I can simply use a dll without an App.config? Any help would be appreciated.
Just to make sure I fully understand... you want VB code to mess with the app.config file, but what is the nature of your actual application? Is it calling PI Web Services? Why do you need/want to use a dll without an app.config?
Steve PilonJust to make sure I fully understand... you want VB code to mess with the app.config file, but what is the nature of your actual application? Is it calling PI Web Services? Why do you need/want to use a dll without an app.config?
I believe Remi is looking for a way that he can instantiate a ServiceClient without relying on the settings in the App.config file. This situations can arise for many reasons, the most prominent one that I always encounter has to do with the fact that your ServiceReference is configured in a .dll (a library project) instead of an executable project.
Dll's (or library projects) do not support App.config. You have to either read the config file 'manually', get settings from some other source (db, AF) or have the settings hard-coded. This situation also arises when you need a ServiceReference from a AFDataReference (basically the same issue: it's a library/dll).
You can solve this by making use of the different constructor overloads of the ServiceClient. If you take a close look at the constructor of your ServiceClient, you will see it accepts several configuration options. The simplest would be to use a binding (e.g. BasicHttpBinding() and a url to the service).
Consume WCF without app.config (StackOverflow)
Consume a SOAP service without relying on app.config (StackOverflow)
How to configure WCF without app.config This one is very interesting, because it mentions ConfigurationManager.OpenMappedExeConfiguration . A 'new' way in .NET 4 to manually load an app.config file. This can be very usefull.
Remi, I was wondering if this solved your issue.
Can you close the loop for future reference? Thanks!
Retrieving data ...