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
Solved

WCF Service and ServiceModel Config

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

791 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