我们可以在WCF消息检查器内注入服务吗?
我有一个WCF应用程序,其中有消息检查器(IDISPATCHMESSAGEINSPECTOR)。现在,我想向其中注入服务,但无法弄清楚如何做到这一点或是否可能。
我有一个MVC项目在同一解决方案中,我可以在MVC操作过滤器中进行财产注入,但不确定如何使用WCF消息检查员进行。
这是我的消息检查员:
public class MessageValidator : IDispatchMessageInspector
{
public IFeatureService FeatureService { get; set; }
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
{
///
}
}
我尝试在AutoFac Bootstrapper中注册我的消息验证器,因此:
builder.RegisterType<MessagaeValidator>().SingleInstance().PropertiesAutowired();
IfeAtureservice的注册已经完成并且在其他WCF服务中正常工作,但无法使其在消息检查员内部使用。 我该怎么做?
I have a wcf application where I've a message inspector (IDispatchMessageInspector). Now I want to inject a service into it but can't figure out how to do that or if it's possible or not.
I've a mvc project in the same solution and I can do property injection in mvc action filters but not sure how to do same with wcf message inspectors.
Here is my message inspector:
public class MessageValidator : IDispatchMessageInspector
{
public IFeatureService FeatureService { get; set; }
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
{
///
}
}
And I've tried registering my message validator in the autofac bootstrapper like this:
builder.RegisterType<MessagaeValidator>().SingleInstance().PropertiesAutowired();
The registration for IFeatureService is already done and working fine in other wcf services but can't make it work inside of a message inspector.
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论