WAS 非 HTTP 激活 - 挂钩应用程序启动
我正在尝试将 WAS 内托管的基于 netTcpBinding 的应用程序与 IoC 容器(autofac/spring)集成。不幸的是,当它在 WAS 内部启动时,由于它不是基于 Http 的应用程序,因此全局应用程序类内部不会触发任何事件。
我需要捕获应用程序域启动,以便我可以配置 IoC 容器。在 WAS 中托管时有什么办法可以做到这一点吗?
我见过涉及在 App_Code 文件夹中使用静态类的可怕事情,但我想要一些更可测试且不太脏的东西。
I'm trying to integrate a netTcpBinding based application that is hosted inside WAS with an IoC container (autofac/spring). Unfortunately, when it starts inside WAS and due to the fact that it is not an Http based application, no events are fired inside the Global application class.
I need to catch the application domain startup so that I can configure the IoC container. Is there any way to do this when hosting in WAS?
I've seen horrible things involving using static classes inside App_Code folders, but I'd like something somewhat more testable and not quite as dirty.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以实现 IInstanceProvider(请参阅 http://msdn.microsoft .com/en-us/library/system.servicemodel.dispatcher.iinstanceprovider.aspx)并告诉 WCF 运行时通过服务行为使用它。
可以使用自定义主机、配置或属性来配置服务行为。这是后者的一个例子:
You can implement IInstanceProvider (see http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.iinstanceprovider.aspx) and tell the WCF runtime to use it via a service behavior.
The service behavior can be configured with a custom host, configuration or with an attribute. Here an example of the latter: