WCF在企业中的应用,您的经验有什么指点吗?
希望听取在企业环境中使用 WCF 的人们的意见。
推出的主要障碍是什么? 性能问题? 任何和所有提示表示赞赏!
如果可以的话,请提供一些一般统计数据和服务器配置!
Looking to hear from people who are using WCF in an enterprise environment.
What were the major hurdles with the roll out?
Performance issues?
Any and all tips appreciated!
Please provide some general statistics and server configs if you can!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
WCF 可能是配置地狱。 请务必熟悉其诊断和 svcTraceViewer,以免您制造一些神秘的、无用的例外。 并注意生成的客户端 一次性模式的损坏实现。
WCF can be configuration hell. Be sure to familiarize yourself with its diagnostics and svcTraceViewer, lest you get madenning cryptic, useless exceptions. And watch out for the generated client's broken implementation of the disposable pattern.
我最近受聘于一家公司,该公司之前使用传统的 ASP.NET Web 服务处理客户端/服务器通信并来回传递数据集。
我重新编写了核心,所以现在有一个 Net.Tcp“连接”客户端......并且一切都通过那里完成。 这是为期一周的“生产中的发现”……但非常值得。
我们在游戏后期必须找出的痛点是:
1) 默认限制阻止第 11 个用户(默认只允许 10 个)。
2)默认的“maxBufferSize”设置为65k,因此需要下载的第一个位图导致服务器崩溃:)
3)其他默认配置(最大并发连接数、最大并发调用数等)。
总而言之,这绝对是值得的......只需更改其基础设施,应用程序就会快得多,现在我们已经“连接”用户......服务器可以向客户端发送消息。
其他美好的收获是,由于我们 100% 知道谁已连接,因此我们实际上可以在应用程序级别执行我们的许可策略。 在此之前(也是在我被雇用之前),我的公司必须简单地登录,然后在月底向客户收取连接次数过多的额外费用。
I've been recently hired to a company that previously handled their client/server communication with traditional asp.net web services and passing dataset's back and forth.
I re-wrote the core so now there is a Net.Tcp "connected" client... and everything is done through there. It was a week worth of "in-production-discoveries"... but well worth it.
The pain points we had to find out late in the game was:
1) The default throttling blocked the 11th user onward (it defaults to allow only 10).
2) The default "maxBufferSize" was set to 65k, so the first bitmap that needed to be downloaded crashed the server :)
3) Other default configurations (max concurent connections, max concurrent calls, etc).
All in all, it was absolutely worth it... the app is a lot faster just by changing their infrustructure and now that we have "connected" users... the server can send messages down to the clients.
Other beautiful gains is that, since we know 100% who is connected, we can actually enforce our licensing policy at the application level. Before now (and before I was hired) my company had to simply log, and then at the end of the month bill the clients extra for connecting too many times.
如前所述,配置噩梦和异常可能是神秘的。 您可以启用跟踪并使用跟踪日志查看器来通常解决问题,但这绝对是一种对 WCF 服务进行故障排除的转变,尤其是在您部署了它并且在代码执行之前遇到问题时。
为了在我的组织内的组件之间进行通信,我最终在我的服务和代理上使用了
[NetDataContract]
,这是推荐的(您无法与 .NET 之外的平台集成,并且要集成,您需要的程序集有合同)尽管我发现它的性能非常出色,并且通过使用它减少了我的整体开发时间。 对我们来说,这是正确的解决方案。As already stated, configuration nightmare and exceptions can be cryptic. You can enable tracing and use the trace log viewer to generally troubleshoot a problem but its definitely a shifting of gears to troubleshoot a WCF service, especially once you've deployed it and you are experiencing problems before your code is even executing.
For communication between components within my organization I ended up using
[NetDataContract]
on my services and proxies which is recommended against (you can't integrate with platforms outside of .NET and to integrate you need the assembly that has the contracts) though I found the performance to be stellar and my overall development time reduced by using it. For us it was the right solution.WCF 绝对非常适合企业应用,因为它的设计考虑了可伸缩性、可扩展性、安全性等......。
正如 maxidad 所说,这可能非常困难,因为异常通常几乎不会告诉您任何信息,如果您使用安全性(显然对于企业场景),您必须处理证书、无意义的 MessageSecurityException 等。
处理 WCF 服务肯定比处理旧的 asmx 服务更困难,但是一旦您进入,就值得付出努力。
提供服务器配置对您来说没有用,因为它必须适合您的场景。 使用正确的绑定以及安全性和并发性都非常重要。 使用 wcf 时没有单一的方法。 想想你的要求。 您需要回调吗?您的用户是什么? 您需要什么样的安全保障?
然而,WCF 绝对是企业级应用程序的正确技术。
WCF is definitely great for enterprise stuff as it is designed with scalability, extensibility, security, etc... in mind.
as maxidad said, it can be very hard though as exceptions often tell you nearly nothing, if you use security (obvisously for enterprise scenarios) you have to deal with certificates, meaningless MessageSecurityExceptions and so on.
Dealing with WCF services is definitely harder than with old asmx service, but it's worth the effort once you're in.
supplying server configs will not be useful to you as it has to fit to your scenario. using the right bindings is very important, as well as security, concurreny. there is no single way to go when using wcf. just think about your requirements. do you need callbacks, what are your users? what kind of security do you need?
however, WCF will be definitely the right technology for enterprise scale applications.