The error happens while client tries to authenticate the server. It does so by comparing the server identity as appears in its X.509 to the server identity you configured to expect. If you haven't configured it than it assumes the service url domain name is the expected identity (for example "localhost" is expected for "http://localhost/MyService.svc").
The solution is to do exactly as the error tells us: Define the expected identity in the configuration. In app.config it can look something like this:
and in the configuration editor as bellow: