English 中文(简体)
统一——加入一个世界文化基金服务阶层?
原标题:Unity - Interception for a WCF service class?

i) 用户和邮局;服务器应用程序,利用世界功能基金进行通信。 在每个海关会议的信息中增加一些信息,即把客户的WCF频道划入“ClientChannelProxy”级,并利用“团结拦截”的延伸,在使用方面增加我的客户信息。

IUnityContainer container = new UnityContainer();
container.AddNewExtension<Interception>();
container.RegisterType<IClientService, ClientServiceProxy>();
container.Configure<Interception>().SetInterceptorFor<IClientService>(new
TransparentProxyInterceptor());

这对客户来说是值得称道的,因为可以按上述代码对统一集装箱进行没收和拦截。

But how to setup unity and interception on the server side? My WCF service is configured in a .SVC file, i don t have any possiblity to configure interception and getting my aspects executed.

<%@ ServiceHost Language="C#" Debug="true" Service="Test.ClientService" %>
<!-- How to configure Unity Interception for this WCF-Service ? -->

Would ne nice if anyone could help me getting it working. Thanks!

最佳回答

You need to create an inspector/interceptor on the server side. You may refer to this post: WCF Parameter Validation with Interceptor and http://msdn.microsoft.com/en-us/library/ms751495.aspx

问题回答

You could enable your WCF service with DI on implementing your own InstanceProvider, ServiceHost, etc. with Unity. So you ll be able to plug your aspect.

Here s an exemple of how it could be achieved : http://initializecomponent.blogspot.com/2008/06/integrating-unity-with-wcf.html





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签