MVC ActionFilter like attributes for WCF

南笙酒味 提交于 2019-12-09 16:23:44

问题


Is there a way I can create custom method attributes for WCF that allow me to easily decorate a service method with a pre filter much like MVC uses action filters. I plan to use them for authentication and authorization. This is for a RESTful service whose requests are carrying an authentication cookie.

I am more interested in how to create the attributes rather than the authentication side of things. Does the HTTP Toolkit offer anything?

Thanks


回答1:


WCF has great extensibility - in many ways. You can encapsulate lots of functionality into e.g. service and/or operation behaviors, which can be attached to a service or operation by means of an attribute.

Check out the current DotNet Rocks TV Show #202 with Miguel Castro on WCF extensibility - it should give you an idea of what is possible (and lots more is possible, for sure!)

See also:

  • WCF Extensibility Samples
  • WCF Extensibility Deep Dive
  • WCF Extensibility Screencast


来源:https://stackoverflow.com/questions/6812054/mvc-actionfilter-like-attributes-for-wcf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!