The "app.config" file we use is located in the root of our hosting project in
Visual Studio (at the same level as Properties and References when looking at
the Solution Explorer). When you compile your app the values that are
contained in the app.config will get placed into the
"ApplicationName.exe.config" file for you automatically.
We have found some issues ... mostly dealing with Callback contracts using
1-way communication ... using WCF ServiceTypes in external DLLs. We
originally got everything working by having the interfaces (the Contracts)
and the implementing classes (the ServiceTypes) residing directly in our
application, and along with the "ABCs" - Address, Binding, Contracts"
settings in app.config. We then refactored our code and moved it into an
external "WCFLibrary" and most pieces work, but anything that uses a callback
contract quit working for reasons unknown.
Not sure about specifing a location for the app.config settings because
ultimatly they end up in your ApplicationName.exe.config to be used during
runtime.
Make sure that the fully qualified names are used in your configuratione
file for the contract attribute in the endpoint element (we also use it for
our name attribute in our service behaviorConfiguration elements too).
--
Stay Mobile
"Mark Brouwers" wrote:
> HI,
> I'm a newbie to WCF had heve following question.
> What is the location of a config file. I've created an application that
> references an other assembly that uses WCF. My application has a config file
> application.exe.config and my referenced client has a client.dll.config. The
> reference dll is a component that searches for articles in our DB. As soon
> as I call new ArtikelServiceClient() I get an error (see below)
> It look to me that it can't find the condig file. I copied the
> client.ddl.config in the exe-directory, but no luck.
> Is there a way to specift the location of my condig file (like in .net
> remoting RemotingConfiguration.Configure)
> Hope I made myself clear.
>
> TIA
> Mark
>
> Here's the error :
> System.InvalidOperationException was unhandled
> Message="Could not find default endpoint element that references contract
> 'ClientArtikel.ws_Art.IArtikelService' in the ServiceModel client
> configuration section. This might be because no configuration file was found
> for your application, or because no endpoint element matching this contract
> could be found in the client element."
> Source="System.ServiceModel"
> StackTrace:
> at
> System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint
> serviceEndpoint, String configurationName)
> at System.ServiceModel.ChannelFactory.ApplyConfiguration(String
> configurationName)
> at System.ServiceModel.ChannelFactory.InitializeEndpoint(String
> configurationName, EndpointAddress address)
> at System.ServiceModel.ChannelFactory`1..ctor(String
> endpointConfigurationName, EndpointAddress remoteAddress)
> at System.ServiceModel.ClientBase`1..ctor()
> at ClientArtikel.ws_Art.ArtikelServiceClient..ctor() in
> D:\_LPBS2005\CLIENT\Artikel\Service References\ws_Art.cs:line 1888
> at ClientArtikel.ArtBas.Zoek_Artikelen(Int16 firma, String artikelnr,
> String taal, LPBSTrace tr) in
> D:\_LPBS2005\CLIENT\Artikel\Classes\ArtBas.cs:line 42
> at GUIArtikel.frmArtikelen.SelBar_OnEindeSelectieEvent() in
> D:\_LPBS2005\GUI\Artikel\Forms\Artikelen.cs:line 52
> at GUIArtikel.frmArtikelSelectie.btnRefresh_Click(Object sender,
> EventArgs e) in D:\_LPBS2005\GUI\Artikel\Forms\ArtikelSelectie.cs:line 29
> at System.Windows.Forms.Control.OnClick(EventArgs e)
> at System.Windows.Forms.Button.OnClick(EventArgs e)
> at System.Windows.Forms.Button.WndProc(Message& m)
> at
> System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
> at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
> m)
> at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
> Int32 msg, IntPtr wparam, IntPtr lparam)
> at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef
> hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
> at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam,
> IntPtr lparam)
> at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd,
> Message& m)
> at System.Windows.Forms.Control.WmCommand(Message& m)
> at System.Windows.Forms.Control.WndProc(Message& m)
> at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
> at System.Windows.Forms.ContainerControl.WndProc(Message& m)
> at System.Windows.Forms.Form.WndProc(Message& m)
> at
> System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
> at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
> m)
> at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
> Int32 msg, IntPtr wparam, IntPtr lparam)
> at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
> wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
> at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
> at System.Windows.Forms.Control.DefWndProc(Message& m)
> at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
> button, Int32 clicks)
> at System.Windows.Forms.Control.WndProc(Message& m)
> at System.Windows.Forms.ButtonBase.WndProc(Message& m)
> at System.Windows.Forms.Button.WndProc(Message& m)
> at
> System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
> at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
> m)
> at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
> Int32 msg, IntPtr wparam, IntPtr lparam)
> at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
> msg)
> at
> System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
> dwComponentID, Int32 reason, Int32 pvLoopData)
> at
> System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
> reason, ApplicationContext context)
> at
> System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
> ApplicationContext context)
> at System.Windows.Forms.Application.Run(Form mainForm)
> at LPBS.AppMain.Main(String[] args) in
> D:\_LPBS2005\APP\LPBS\MAIN\Classes\AppMain.cs:line 229
> at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
> args)
> at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
> assemblySecurity, String[] args)
> at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
> at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
> at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
> at System.Threading.ThreadHelper.ThreadStart()
>
>
>