Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

WCF Service and ServiceModel Config

Posted on 2008-06-26
2
Medium Priority
?
1,743 Views
Last Modified: 2013-11-07
Hi all,

1. I am consuming a WCF service in a class library that returns data from the service.
2. I reference this project in my BLL where I have a method  GetUsers() which calls the GetUsers() method on the WCF Service and returns a list of users.
3. My Web app reference the BLL and I make calls through the BLL to get a list of users and bind them to a GridView.

However I was getting an error because I had not included the <system.ServiceModel> section in my web apps web.config file. This section provides the Binding and Client information for the WCF Service.

Can somebody please tell me why I need this section in my web.config file as it is already in the app.config of the class library? I do not know why it is needed as my web app does not directly communicate and call methods on the service, this is done through my BLL? Surely this is coupling my web app to the WCF class library which I do not want to do as I need it to be loosely coupled, just like I do with my DAL which my web app knows nothing about.

Many thanks

Cragly
0
Comment
Question by:Cragly
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Expert Comment

by:CuteBug
ID: 21886585
For web apps, the framework looks for the web.config file, whereas for normal applications the app.config file is referred.
0
 

Accepted Solution

by:
OMXBSICE earned 1500 total points
ID: 21953399
Each application in .NET only uses one .config file.  So if you implement a DLL and then later use that DLL with an other application you need to put all the config that the DLL needs into that applications .config file.Example:MyClassLibrary.dll
MyApplication.exe  (makes use of the DLL)Now all the config that MyClassLibrary.DLL needs has to be in the MyApplication.exe.config because that is the only config that will be used.NOTE: .NET creates this config file when it compiles the .exe from the app.config file in the MyApplication project.If you however have a web application the only config file that will be used is the web.config file and hence you the configs for your DLL need to be in there.


0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question