WCF MSMQ 与 IIS 服务绑定 - 如何实例化该服务?
我有一个带有 netMsmqBinding 的 WCF 服务。我的客户端可以将消息发送到我的队列,并且当服务运行时,它会按预期从队列中检索消息。如果服务未运行,收到的消息将排队直到服务启动。
我的问题是当消息进入队列时服务不会启动。该服务托管在 IIS 中,因此在 IIS 收到请求之前不会实例化该服务。如果我浏览到该服务,那么它会处理队列中的消息,但显然这不是我想要的处理队列的方法!
我预计需要更改服务实现,或更改 IIS 设置,但我不知道在哪里更改或更改什么。
更新
有人真的通过 WCF 使用 MSMQ 吗?我让它工作了很短一段时间 - 我在同一服务器上的不同网站上启用了绑定,奇怪的是 - 但现在它以某种方式再次停止工作。
我遇到的唯一问题是当队列中有消息时激活服务。目前,队列仅在实例化服务时进行处理,例如当我浏览.svc 文件时。我在应用程序上启用了 net.msmq 协议,并且在网站上启用了 net.msmq 绑定...我还需要做什么吗?
I have a WCF service with netMsmqBinding. My client can send messages to my queue, and when the service is running it retrieves messages from the queue as expected. If the service is not running, messages received are queued until the service starts.
My problem is that the service does not start when a message hits the queue. The service is hosted in IIS, and so it is not instantiated until IIS receives a request. If I browse to the service then it processes the messages in the queue, but obviously this is not my desired method of processing the queue!
I expect that I need to change the service implementation, or change the IIS setup, but I do not know where or what to change.
UPDATE
Does anyone actually use MSMQ over WCF? I had this working for a short time - I enabled the binding on a different website on the same server, bizarrely - but now it has somehow stopped working again.
The only problem I am having is with the Activation of the service when there is a message in the queue. At present the queue only processes when the service is instantiated, e.g. when I browse the the .svc file. I have the net.msmq protocol enabled on the application, and I have the net.msmq binding enabled on the site... is there anything else I need to do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您明确需要配置 IIS 以进行非 HTTP 激活。我不知道我脑子里的所有细节,但基本上你需要使用 appcmd 来配置和启用 net.msmq 绑定激活。
检查此博文 或 此截屏视频应该为您提供所有详细信息。
You explicitly need to configure IIS for non HTTP activation. I don't know all the details of the top of my head but basically you need to use appcmd to configure and enable the net.msmq binding activation.
Check this blogpost or this screencast should give you all the details.
这可能会节省我花费的时间:
http://msdn.microsoft.com/en-us/library/ms731053。 ASPX
This might save somebody the hours it took me:
http://msdn.microsoft.com/en-us/library/ms731053.aspx
我相信我在 WCF 上使用 MSMQ 绑定的问题主要与 IIS 相关。
我在使用带有 IIS 6 的 Windows XP / Server 2003 时遇到了无穷无尽的问题。
使用带有 IIS 7.5 的 Windows 7 或 Server 2008 一切正常。
更好的建议是将 MSMQ 作为托管服务/Windows 服务或独立应用程序运行,而不是在 IIS 下运行。
I believe that my problems using MSMQ binding over WCF were mainly around IIS.
I had no end of problems using Windows XP / Server 2003 with IIS 6.
Using Windows 7 or Server 2008 with IIS 7.5 everything works well.
An even better suggestion is to run MSMQ as a managed service / Windows Service or a stand-alone application rather than under IIS.