Common Issues
Endpoint not found
▶
This error usually means the client cannot locate the service address or the binding configuration is mismatched.
System.ServiceModel.EndpointNotFoundException:
Could not find a suitable endpoint element with name '' and contract 'IMyService' in the ServiceModel client configuration section.
Remedies
- Verify the service address in
app.config
orweb.config
. - Ensure the binding types match on both client and server.
- Check that the service is running and the endpoint is reachable (e.g., via curl).
Security negotiation failed
▶
Security misconfiguration often leads to this exception.
System.ServiceModel.Security.SecurityNegotiationException:
The remote party sent a message that could not be understood.
Checklists
- Both client and service must use the same
SecurityMode
. - If using certificates, ensure they are installed in the correct store and have proper permissions.
- Validate the clock synchronization between machines.
Serialization errors
▶
DataContract mismatches cause serialization failures.
System.Runtime.Serialization.SerializationException:
There was an error deserializing the object of type 'MyNamespace.MyType'.
Solutions
- Make sure
[DataContract]
and[DataMember]
attributes are applied consistently. - Check for versioning issues – added/removed members require
EmitDefaultValue
handling. - Ensure collections implement
IEnumerable
and are serializable.
Performance bottlenecks
▶
Common performance pitfalls and mitigation strategies.
Typical Causes
- Large messages without streaming.
- Excessive use of
ReliableSession
. - Improper throttling settings.
Recommendations
- Enable
TransferMode.Streamed
for large payloads. - Adjust
ServiceThrottlingBehavior
(maxConcurrentCalls, maxConcurrentSessions). - Profile using
SvcTraceViewer
and Windows Performance Monitor.