IDIspatch消息检查器
我实现 IDispatchMessageInspector.AfterReciveRequest 然后我这样配置:
<configuration>
<system.serviceModel>
<services>
<service
name="Microsoft.WCF.Documentation.SampleService"
behaviorConfiguration="inspectorBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/SampleService" />
</baseAddresses>
</host>
<endpoint
address=""
binding="wsHttpBinding"
contract="Microsoft.WCF.Documentation.ISampleService"
/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="inspectorBehavior">
<serviceInspectors />
</behavior>
</serviceBehaviors>
</behaviors>
<extensions>
<behaviorExtensions>
<add
name="serviceInspectors"
type="Microsoft.WCF.Documentation.InspectorInserter, HostApplication, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
/>
</behaviorExtensions>
</extensions>
</system.serviceModel>
</configuration>
但是不起作用。
我检查了我的程序集和本地引用,但没有找到 Microsoft.WCF.Documentation.InspectorInserter
或 HostApplication
dll 我在网上搜索下载 HostApplication
dll 但我什么也没找到。
我必须做什么?
我需要实现更多的东西或者我只需要这个配置。
I Implement IDispatchMessageInspector.AfterReciveRequest
Then I configure like this:
<configuration>
<system.serviceModel>
<services>
<service
name="Microsoft.WCF.Documentation.SampleService"
behaviorConfiguration="inspectorBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/SampleService" />
</baseAddresses>
</host>
<endpoint
address=""
binding="wsHttpBinding"
contract="Microsoft.WCF.Documentation.ISampleService"
/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="inspectorBehavior">
<serviceInspectors />
</behavior>
</serviceBehaviors>
</behaviors>
<extensions>
<behaviorExtensions>
<add
name="serviceInspectors"
type="Microsoft.WCF.Documentation.InspectorInserter, HostApplication, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
/>
</behaviorExtensions>
</extensions>
</system.serviceModel>
</configuration>
but it doesn't work .
I check in my assembly and in my local reference and I didnt found Microsoft.WCF.Documentation.InspectorInserter
or HostApplication
dll
I search in the net to download HostApplication
dll but I found nothing.
What do I have to do?
I need to implement more thing or I Just need this configuration.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现使用也扩展了 Attribute 的 IServiceBehavior 实现来附加 IDispatchMessageInspector 实现要容易得多。然后在 ApplyDispatchBehavior 方法中,将消息检查器附加到所有通道中的所有端点。
这篇文章对我帮助很大。
示例代码:
然后在服务契约的实现中,您只需将属性添加到类中即可。
I found it much easier to attach my IDispatchMessageInspector implementation using an IServiceBehavior implementation that also extends Attribute. Then in the ApplyDispatchBehavior method, attach your message inspector to all the all of the endpoints in all of the channels.
This article helped me greatly.
Example code:
Then in the implementation of your service contract, you can just add the attribute to the class.