Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9106545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:21:46+00:00 2026-06-17T02:21:46+00:00

In my test project, I created a WCF service and got it running. Next,

  • 0

In my test project, I created a WCF service and got it running.
Next, I created an MVC 4 project. It is broken into layers under one solution.

  • The model layer.
  • The UI/View/Controller layer
  • The repository layer.

To do a quick test:
In the UI layer, I added a web reference to my WCF service. In the controller, I contacted the WCF service by “using” to populate a dropdown in the view.

However, I’m driving for separation with Dependency Injection.

In the repository layer, I created an Interface with the populate dropdown and injected it. Not a problem.

What I’m struggling with the concept is:

  1. Do I consume the WCF service in the UI layer and reference it in the repository layer? (doesn’t seem right)
  2. Do I create another project – a data layer – and add a web reference to the WCF service then from the repository, I create a reference to the data layer?

Which brings me to another question – if I create a web reference to a WCF service in a separate project (layer), the information pertaining to the WCF service is not present in the main config.sys file…

So I’m struggling to grasp this portion…anything I should be reading up on some more?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:21:48+00:00Added an answer on June 17, 2026 at 2:21 am

    Realizing that your cake can be cut in many ways, I present you here with my take on how to cut it:

    Question #1: “Do I consume the WCF service in the UI layer and reference it in the repository layer?”
    First off: As Steven points to in your comment, you should consider deeply if you want to inject a third server tier. The UI layer can be renamed to the “layer that is hosted in IIS”. Doing so makes it the host layer for both your MVC presentation layer and the host layer for the services.
    However this does not mean that your services are implemented in this layer, only that they are hosted here (a matter of referencing the interfaces and implementation namespaces in the web.config only).

    Question #2: “Do I create another project – a data layer – and add a web reference to the WCF service then from the repository, I create a reference to the data layer?”
    As I read this you are asking multiple questions at once: Yes, you should create a separate layer to encapsulate the repository. No you should not let this layer contain anything related to wcf. If a server layer needs client access to a wcf service, you should separate this into a logical layer, either residing as a folder in your businesslogic layer, or as a separate physical “data adapter layer”. Never ever in your repository layer. While it is true that conceptually the wcf data adapter layer is at the same level as your repository layer, you should not mix database access and service access in the same logical or physical layer.

    The third question I can only answer as a question: What purpose is it that you want WCF to fullfil in your architecture? Do you want to inject a separate service tier or have you confused layer separation with tier separation?

    Layer separation can be coupled runtime in-process, while tier separation can only be coupled runtime through some sort of on-the-network remoting (such as wcf).

    As Steven points out in his comment, you havnt really documented the need to use wcf in your architecture at all.

    Lets look at your architecture in terms of the logical layers and tiers (cutting the cake):

    • Client-Access-Layer (#1, running in the context of the browser)

    • Web-Host-Layer (#2, representing the outer server tier, contains all MVC code. Perhaps Model exists in its own physical layer.

    • Service-Layer (Not existing yet in your architecture, as there have been no need demonstrated for this further abstraction of layers into tiers)

    • Business-Layer (#2, representing the business logic that lies between presentation and database and data access layers)

    • Repository layer (#2, encapsulating database access logic and mapping)

    • Service Access layer (#2, encapsulating access to services on the outside, can be implemented as a folder in BL layer or in a separate physical layer)

    • Database tier (#3, the sql server)

    So are you asking how to implement DI in WCF using IIS as the host and C# as the implementation language.

    Or.

    Are you asking general guidance into architecturing a n-tier .net application.

    The first is easy, as there a tons of examples out there, such as this

    The second is more tricky as the answer will always be “it depends”.
    It depends on what your needs are, what your level of expertise is, what the projected timespan of your project is and so on.

    Hope this helps you a bit.

    If you want I can send you my implementation of the behavior wcf unity stuff.

    Concepts:

    • Logical layer – an architectural concept used to isolate responsibility. Layers have downward coupling, never upwards.

    • Physical layer – an implementation construct used to enforce the logical separation. A .net assembly can be used as the implementation of a physical layer.

    • Tier – one or more layers that can exist on a machine that is not hosting other tiers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a WCF service and was trying to test one of the
I have created a unit test in my c# project which builds into a
I created a solution VS2010 C# with the WCF service, the library to get
I've got a small WCF service I've created. I can edit it and get
I'm creating an app based on SOA, I've created WCF Service Project using Framework
I recently managed to get a WCF service running in IIS. I created a
I have a VS 2010 solution containing a WCF service project and a unit
I have a WCF web service called Palladium that is created as a project
I'm trying to learn WCF and I've created a new WCF Service Library project
I created a simple Asp.net MVC 4 application I created the NUnit test project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.