Solved

How does WCF resolve which concrete class is used when its service is called?

Posted on 2014-03-06
3
672 Views
Last Modified: 2014-03-07
I began my WCF web service with the standard Service.cs and IService.cs.  I have since made enhancements to the individual methods (OperationContracts) in a new MyService.cs file that also inherits from IService.cs.

I looked through the App.Config and found that the "contract" being referenced is the interface class but see no code, yet, that choses which concrete implementation class should be used when its called.

Does ,NET WCF always call the use the class that is the same name as the interfaces(minus the "I")?
0
Comment
Question by:Bruce
[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
3 Comments
 
LVL 25

Assisted Solution

by:apeter
apeter earned 250 total points
ID: 39912016
No it is not always just the minus. You can have any name for your concrete class.

You can use a concrete class as service contract but below are the benefits you get when using interfaces. All your .svc file markup has attribute "Service" which points to the class implements the service. So when you use the address to create proxy class using "add reference" or  client channel factory, run time knows which class to invoke.


•Service contract interfaces can extend any number of other service contract interfaces.
• A single class can implement any number of service contracts by implementing those service contract interfaces.
• You can modify the implementation of a service contract by changing the interface implementation, while the service contract remains the same.
• You can version your service by implementing the old interface and the new one. Old clients connect to the original version, while newer clients can connect to the newer version.
0
 
LVL 16

Accepted Solution

by:
SriVaddadi earned 250 total points
ID: 39912152
In short, It is resolved from the fully qualified service name specified in the configuration that is implementing the service contract specified in the configuration.

You do not need to use the same name but what ever the name you use, your service configuration should be updated accordingly.
0
 
LVL 1

Author Closing Comment

by:Bruce
ID: 39912666
Thank you!!
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

615 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