开发者

Convention-driven configuration for WCF (server-side)

Just started on a new project and opened up a 1600 line web.config file for a WCF project, where 90% of the services are configured identically (hmfph).

I like a project to be easy to manage, with as few redundant lines of code as possible. So my question is whether or n开发者_JS百科ot it is possible to configure multiple WCF service by using convention-driven configuration instead.

Kind of like Fluent NHibernate Automapper with the possibility to create overrides when needed (like custom endpoints etc). Any thoughts?

/Jasper


WCF in .NET 4 has a lots of convention-based configuration - as long as you don't start specifying your own stuff, each service defined in your web.config will get a default endpoint for each of the base addresses defined in your web.config - that alone can cut out 50-80% of your config.

Furthermore, you can define default behaviors, e.g. for your services; things like always expose metadata and make it available from HTTP and so forth can be defined once, as a "template" behavior and will be applied to all service entries without further ado.

Check out all the details of what's new in WCF 4 and how to make use of the convention-driven configuration ("no config WCF") here: A Developer's Introduction to WCF 4

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜