Solved

WCF Service and ServiceModel Config

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

18 Experts available now in Live!

Get 1:1 Help Now