Solved

WCF Service and ServiceModel Config

Posted on 2008-06-26
2
1,742 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 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

729 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