这样修改有哪些优缺点 wcf service via attribute setting vs config

客户要恢复数据,结果就是block在某个阶段,在server端log一圈下来,发现原来是client端出了问题,就是这个log:

ERROR - Identity check failed for outgoing message. The expected DNS identity of the remote endpoint was 'pc1.company1.edu.au' but the remote endpoint provided DNS claim ' pc1xx.company1 .edu.au'. If this is a legitimate remote endpoint, you can fix the problem by explicitly specifying DNS identity ' pc1xx.company1.edu.au' as the Identity property of EndpointAddress when creating channel proxy.

怪不得我们这里怎么试都出不来,还是网络的问题。

想当初我把几十个web service的配置通过c#的attribute简化到只有2个模板以后,还很得意的到处宣传,现在发现也还是有问题,就是去掉每个config的同时,牺牲了灵活性,这个就是典型的例子,如果config还在,我只需要简单的为这个service加一个dns identity,可现在就不得不改代码,更讨厌的是为了保证向后兼容,还不能影响其他的service。

现在渐渐明白为什么面试会问这样修改有哪些优缺点了。

--------------------------- 知道的更多,不知道的也更多 ---------------------------
原文地址:https://www.cnblogs.com/mryux/p/11508319.html