Search code examples
c#service-reference

Problem adding Class Library ServiceModel section to Applications app.config


I have read on a number of question/answers how you would need to add the "system.serviceModel" section of a class library that has a service reference to the executing application's app.config if your separate class library has a service reference.

However, I found that I can't just add everything in "system.serviceModel" as my code throws exceptions that it can't find the binding sections. So I had deduced (possibly incorrectly) that a declaration needs to be added to the app.config/configSection section stating what dll uses that section.

When I do that (or attempt to) the application (windows service) crashes as it doesn't like the section I am adding. I was attempting to add it like:

<section name="system.serviceModel" type="projectName.projectFolder.className, projectname" />

I am obviously doing something wrong and I haven't seen what I am missing from any examples.

Thanks in advance.


Solution

  • The answer to my own question, is that you have to fully qualify the client name in the "contract" element in the "Client" section.