在 Windows 7 64 位上从 .NET 2.0 Web 服务写入专用消息队列时出现问题

发布于 2024-11-14 08:46:05 字数 1492 浏览 5 评论 0原文

我在 .NET 2.0 VB Web 服务应用程序的 Web 方法中具有以下代码:

<WebMethod()> _
Public Function UpdateCall(<System.Xml.Serialization.XmlElement("CallChangeRequest")> ByVal callChange As CallChangeMessage) As Boolean

Dim result As Boolean = False
Dim mq As System.Messaging.MessageQueue = Nothing
Dim msg As System.Messaging.Message = Nothing
Try
    mq = New System.Messaging.MessageQueue(System.Configuration.ConfigurationManager.AppSettings("queueName"))
    mq.Formatter = New System.Messaging.XmlMessageFormatter(New Type() {GetType(CallChangeMessage)})

    msg = New System.Messaging.Message(callChange)
    msg.Recoverable = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings("recoverableMessages"))

    mq.Send(msg)

    result = True
Catch ex As Exception
Finally
    If Not (msg Is Nothing) Then msg.Dispose()
    If Not (mq Is Nothing) Then mq.Dispose()
End Try

    Return result

End Function

此代码正确序列化我的对象并将 XML 消息写入运行 Windows XP Pro 32 位的旧本地开发计算机上的消息队列。它也在生产服务器上正确执行。升级到Windows 7 64位后,这段代码将不再将XML消息写入消息队列中。对 msg.Send(msg) 的调用不会引发异常,因此我的 Web 方法向调用者返回 true。但是,没有消息写入队列,因此代码只是默默地失败了。

消息标记为“可恢复”,队列名称为 FormatName:DIRECT=OS:.\private$\inbounddata。我已经开放了基本上每个人都可以做所有事情的权限。如果存在权限问题,我会期望得到某种异常,所以我认为我没有权限问题。 Web 服务在面向 2.0 框架的应用程序池中运行,托管管道模式设置为经典。

到目前为止,我的办法是将代码部署在我的旧开发盒上,我仍然保留着它,但我不能永远这样做。我的代码是否存在导致此失败的问题?有谁知道在 Windows 7 64 位上从 32 位 .NET 2.0 框架应用程序写入 MSMQ 存在任何问题吗?

感谢您的帮助!

I have the following code in a web method of a .NET 2.0 VB web service application:

<WebMethod()> _
Public Function UpdateCall(<System.Xml.Serialization.XmlElement("CallChangeRequest")> ByVal callChange As CallChangeMessage) As Boolean

Dim result As Boolean = False
Dim mq As System.Messaging.MessageQueue = Nothing
Dim msg As System.Messaging.Message = Nothing
Try
    mq = New System.Messaging.MessageQueue(System.Configuration.ConfigurationManager.AppSettings("queueName"))
    mq.Formatter = New System.Messaging.XmlMessageFormatter(New Type() {GetType(CallChangeMessage)})

    msg = New System.Messaging.Message(callChange)
    msg.Recoverable = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings("recoverableMessages"))

    mq.Send(msg)

    result = True
Catch ex As Exception
Finally
    If Not (msg Is Nothing) Then msg.Dispose()
    If Not (mq Is Nothing) Then mq.Dispose()
End Try

    Return result

End Function

This code correctly serializes my object and writes an XML message to the message queue on my old local development machine, which was running Windows XP Pro 32-bit. It also performs correctly on the production server. After upgrading to Windows 7 64-bit, this code will no longer write the XML message in the message queue. The call to msg.Send(msg) does not raise an exception, so my web method returns true to the caller. However, no message is written to the queue, so the code is just quietly failing.

The messages are marked as Recoverable, and the queue name is FormatName:DIRECT=OS:.\private$\inbounddata. I've opened up the permissions for basically everyone to do everything. If there were a permission problem, I would expect to get some sort of exception, so I don't think I have a permission problem. The web service is running in an application pool targeting the 2.0 framework with managed pipeline mode set to Classic.

Up to now, my recourse has been to deploy the code on my old development box, which I still have hanging around, but I cannot do that forever. Is there a problem with my code that is causing this to fail? Does anyone know of any issues with writing to MSMQ on Windows 7 64-bit from a 32-bit .NET 2.0 framework app?

Thanks for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如此安好 2024-11-21 08:46:06

不知道发生了什么,但我删除了现有队列,创建了一个新队列,现在一切都很好。感谢您的建议。

Don't know what happened, but I deleted the existing queue, created a new queue, and now all is well. Thanks for the suggestions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文