Solved

WCF Service and ServiceModel Config

Posted on 2008-06-26
2
1,734 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
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 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now