WCF interview questions and answers for .NET developers
WCF interview questions today are mostly about keeping existing services healthy and moving them forward. Expect the ABC of an endpoint (address, binding, contract), the common bindings and when each fits, data and fault contracts, instancing and concurrency modes, hosting in IIS or a Windows service, transport versus message security, and the client proxy mistakes that cause outages. Senior rounds ask how you would migrate a WCF estate to ASP.NET Core, gRPC or CoreWCF without breaking callers.
By Evin JohnPublished 8 min read
Why WCF still comes up in interviews
Banks, insurers, hospitals, manufacturers and government agencies built a lot of internal plumbing on WCF in the .NET Framework years, and much of it still runs. Teams hiring for those systems want two things at once: someone who can fix a faulted channel or a serialization error this week, and someone who can plan the exit. So the questions mix old configuration detail with modern judgment. If your WCF experience is from a few years back, say which bindings and hosts you used, then show you know where the platform stands now. The broader runtime topics are on the .NET interview questions page.
- Concept screenABC, bindings, contracts and serialization, usually as quick verbal questions.
- Read this configA system.serviceModel section or a service class is put in front of you, and you explain what each endpoint and behavior does.
- Debug a failureA timeout, a faulted proxy, a message size error or a security negotiation failure, and how you would narrow it down.
- Migration designWhich services move first, what replaces each binding, and how existing SOAP clients keep working.
WCF fundamentals questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| What is an endpoint in WCF? | Core model | The place clients talk to: an address (where), a binding (how: transport, encoding, security) and a contract (what operations). One service can expose several endpoints. |
| ServiceContract versus OperationContract? | Contracts | ServiceContract marks the interface that defines the service; OperationContract marks each method exposed. Methods without it are invisible to clients. |
| What do DataContract and DataMember do? | Serialization | They opt a type and its members into serialization by DataContractSerializer. Only marked members cross the wire, whatever their C# visibility. |
| Why use a FaultContract? | Errors | Unhandled .NET exceptions should not leak. A FaultContract declares typed SOAP faults the client can catch as FaultException of that detail type. |
| What is a MessageContract? | Wire control | It gives control over the SOAP envelope, such as which values go in headers and which in the body. Most services never need it; some interop cases do. |
| How does WCF compare with ASMX web services? | History | ASMX only did SOAP over HTTP inside IIS. WCF unified HTTP, TCP, named pipes and queues behind one programming model with pluggable bindings and behaviors. |
| What is the MEX endpoint? | Metadata | A metadata exchange endpoint, with the serviceMetadata behavior, that publishes WSDL and schemas so tools can generate a client. |
| How do you create a client? | Clients | Generate a proxy with Add Service Reference or svcutil (dotnet-svcutil on modern .NET), or share the contract assembly and use ChannelFactory of the interface. |
| Where can a WCF service be hosted? | Hosting | In IIS, in IIS with WAS for non-HTTP transports, or self-hosted with ServiceHost in a console app or Windows service. |
| What is a behavior? | Extensibility | A setting or extension applied to a service, endpoint, contract or operation, such as metadata publishing, debug detail, throttling or credentials, outside the contract itself. |
Bindings: what each one is for
| Binding | Typical use | What the interviewer listens for |
|---|---|---|
| BasicHttpBinding | SOAP over HTTP for broad interop, including old ASMX-era and Java clients | No security by default; you add transport security with HTTPS. |
| WSHttpBinding | SOAP with WS-* features: message security, reliable sessions, transactions | Heavier messages and more handshakes, so slower; check the partner can speak WS-*. |
| NetTcpBinding | WCF to WCF inside a network, binary encoding | Fast and compact but .NET-only on both ends; Windows security by default; port and firewall planning. |
| NetNamedPipeBinding | Processes on the same machine | Fastest option, no network traffic at all, and useless across machines. |
| NetMsmqBinding | Queued, disconnected delivery over MSMQ | One-way operations only, poison message handling, and that MSMQ itself is legacy. |
| WebHttpBinding | REST-style endpoints with WebGet and WebInvoke | Workable for JSON over HTTP, but ASP.NET Web API became the usual choice for that. |
| WSDualHttpBinding | Duplex callbacks over HTTP | Needs the client to be reachable for callbacks, which firewalls often block. |
[ServiceContract(Namespace = "urn:example:claims")]
public interface IClaimService
{
[OperationContract]
[FaultContract(typeof(ClaimFault))]
ClaimStatus GetStatus(string claimId);
[OperationContract(IsOneWay = true)]
void SubmitNote(string claimId, string note);
}
[DataContract(Namespace = "urn:example:claims")]
public class ClaimStatus : IExtensibleDataObject
{
[DataMember(IsRequired = true, Order = 1)] public string ClaimId { get; set; }
[DataMember(Order = 2)] public string State { get; set; }
public ExtensionDataObject ExtensionData { get; set; }
}
[DataContract] public class ClaimFault { [DataMember] public string Reason { get; set; } }
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class ClaimService : IClaimService
{
public ClaimStatus GetStatus(string claimId)
{
if (string.IsNullOrWhiteSpace(claimId))
throw new FaultException<ClaimFault>(
new ClaimFault { Reason = "Claim id is required" }, "Bad request");
return new ClaimStatus { ClaimId = claimId, State = "Open" };
}
public void SubmitNote(string claimId, string note) { /* queue it */ }
}Intermediate questions: instancing, faults and clients
- What are the three InstanceContextMode values? PerCall creates a service object for each call, PerSession keeps one per client session (when the binding supports sessions), and Single uses one object for every caller. PerCall scales and stays stateless; Single needs careful locking.
- How does ConcurrencyMode interact with that? Single lets one thread in at a time, Reentrant allows calls back in while the object waits on an outgoing call, and Multiple lets many threads in, so you own thread safety. Single instance plus Multiple concurrency is the combination most likely to hide race conditions.
- What is throttling in WCF? The serviceThrottling behavior caps concurrent calls, sessions and instances. Hitting the caps makes callers queue and then time out, which looks like a slow service rather than an error.
- Why is wrapping a WCF proxy in a using block a known trap? Dispose calls Close, and Close throws if the channel is faulted, hiding the original exception. The usual pattern is try Close, and on CommunicationException or TimeoutException call Abort.
- What does a faulted channel mean? An unhandled error or a security or session failure left the channel unusable. Every later call fails until the client creates a new proxy or channel.
- What is includeExceptionDetailInFaults for? Sending full exception details to clients while debugging. It should be off in production because it leaks stack traces and internals.
- How do you version a data contract safely? Add new members as optional, never rename or reorder existing ones without setting Name and Order, keep the namespace, and implement IExtensibleDataObject so data from newer clients survives a round trip.
- What are known types for? When an operation returns a base type but sends a derived one, the serializer must be told about the derived type with KnownType or ServiceKnownType, or deserialization fails.
- What does IsOneWay do? The client does not wait for a reply or a fault. It can still block while the message is sent, and errors on the service side never reach the caller.
- How does a duplex contract work? The service contract names a CallbackContract, the client implements it, and the service calls back through OperationContext.Current.GetCallbackChannel. It needs a session-capable binding such as NetTcpBinding or WSDualHttpBinding.
- What causes "maximum message size quota exceeded"? The binding's maxReceivedMessageSize, and often reader quotas, are smaller than the payload. Raise them deliberately on the receiving side and ask why the message is so large.
Security, sessions and transactions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| Transport versus message security? | Security model | Transport security (TLS or Windows on TCP) protects the channel point to point and is faster. Message security signs and encrypts the SOAP message itself, so it survives intermediaries, at a performance cost. |
| What does TransportWithMessageCredential mean? | Security mode | TLS protects the channel while the client's credential, such as a username or a token, travels in the SOAP header. |
| How do you authenticate callers on NetTcpBinding inside a domain? | Windows auth | Windows credentials by default, then authorize with roles or a PrincipalPermission check, and keep the service account least-privileged. |
| What does a reliable session add? | Reliability | WS-ReliableMessaging retries and orders messages between the endpoints, so transient network loss does not drop or reorder calls. It adds overhead and has its own timeouts. |
| What are the session-related timeouts? | Config | Open, send, receive and close timeouts on the binding, plus the inactivity timeout of a reliable session. Mismatched values cause sessions to die quietly between calls. |
| How do transactions flow across WCF calls? | Transactions | The binding enables transaction flow, the operation is marked with TransactionFlow, and the service uses TransactionScopeRequired so the work joins the caller's distributed transaction. |
| Why avoid distributed transactions in new designs? | Judgment | They couple services tightly, need a coordinator and fail badly under partitions. Modern designs prefer local transactions, idempotent operations and compensation. |
Senior and migration scenarios
- Can WCF services run on modern .NET? Not with the original server stack, which belongs to .NET Framework. Client libraries exist for modern .NET, and CoreWCF, a community-led port, covers part of the server side. Check its documentation for the bindings and features you rely on.
- How would you migrate 40 WCF services? Inventory bindings, callers and features first. Services on BasicHttpBinding with simple contracts can move to CoreWCF or sit behind a compatible façade; internal NetTcp services are good gRPC candidates; public-facing ones may become ASP.NET Web API endpoints. Move one low-risk service end to end before planning the rest.
- External partners call your SOAP service and cannot change. What do you do? Keep the WSDL and message shapes stable, put contract tests on recorded requests, and migrate behind the same address so partners see nothing change.
- After a deploy, calls time out under load but CPU is low. Where do you look? Throttling limits, a Single instance with Single concurrency serializing every call, a slow downstream call, or clients that never close proxies and exhaust sessions.
- A Java client fails to call your WSHttpBinding service. How do you approach it? Compare what the client supports against the binding's WS-* settings; often switching that endpoint to BasicHttpBinding over HTTPS solves interop.
- How would you log and trace a WCF service? Turn on message logging and tracing briefly with the diagnostics configuration, read them in the trace viewer, and keep correlation ids in your own logs because full message logging is heavy and may capture sensitive data.
Fictional example
- Interviewer
- A desktop app calls a WCF service over NetTcpBinding. Users see errors saying the channel is faulted, and only a restart fixes it. What is happening?
- Candidate
- My first guess is that the app keeps one proxy for its whole life. Once any call fails, or the session times out after inactivity, that channel is faulted and every later call fails too, which matches the restart symptom. I would check the client code for a long-lived proxy and for using blocks that hide the first exception, then look at the service trace for the original error. The fix has two parts: subscribe to the Faulted event or check the state and recreate the channel, and close or abort properly after each unit of work. Then I would look at why the first call failed, because the proxy handling only stops the damage from spreading.
How to prepare for a WCF interview
- Rebuild the model on paper: one service, three endpoints on different bindings, with the behaviors each needs. Explain why each exists.
- Learn the failure catalog: faulted channels, timeouts, message size quotas, serializer errors from missing known types, and security negotiation failures.
- Prepare one maintenance story and one migration story, with the binding, the host, the callers and the result.
- Know the modern options well enough to compare them: CoreWCF, gRPC and REST over ASP.NET Core, with what each keeps and what it drops.
If the job also involves building the replacement services, pair this page with REST API interview questions and C# interview questions. Integration teams that wrap WCF endpoints in a broker see the same contracts from outside, as covered in webMethods interview questions.
Much of a WCF interview is reading configuration and reasoning about failures you cannot reproduce in the room. Natively, an AI interview assistant for Mac and Windows, writes down a mock round on your computer as you talk, so you can check whether your binding comparisons were precise. During practice it can read a config section or a stack trace from a screenshot and suggest what to explain, and the résumé and job description you add (Pro or the free trial) shape its suggestions. Afterward, the transcript and notes are there to review.
Questions people ask
What WCF questions are asked in .NET interviews?
The ABC of endpoints, common bindings and when to use each, service, data and fault contracts, InstanceContextMode and ConcurrencyMode, hosting, transport versus message security, faulted proxies, and how to migrate WCF services to modern .NET.
What is the ABC of WCF?
Every endpoint has an address that says where the service is, a binding that says how to talk to it (transport, encoding, security), and a contract that says which operations it offers.
What is the difference between BasicHttpBinding and WSHttpBinding?
BasicHttpBinding sends simple SOAP over HTTP for broad interoperability and has no security by default. WSHttpBinding adds WS-* features such as message security, reliable sessions and transactions, at the cost of heavier messages.
Is WCF supported in .NET Core and later?
The original WCF server stack belongs to .NET Framework. Modern .NET has WCF client packages, and CoreWCF, a community-led port, covers part of the server side. Many teams move to ASP.NET Core Web API or gRPC instead.
Where to go next
Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.
Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.
