Hangfire MSMQ processed in server 1 but stuck in server 2 - msmq

I'm using Hangfire with MSMQ.
Here is the setup
2 Front-end Servers (for IIS), I will call them web1 and web2
A 3rd server for Hangfire Windows Service (I'll call it app1)
A load balancer between them.
Problem
When I tried to access Hangfire dashboard using the hostname (let's say koko.com/hangfire) the message will be enqueued in one of the web servers MSMQs. You can see it in Outgoing MSMQ messages in web1 or web2.
So I did more investigation to know why the message is not moving out from Outgoing Messages.
I simply accessed the dashboard from http://localhost/hangfire in web1 and it works. then I enqueued the jobs from there and it did not work. When I repeat the same process in web2 it works!
Why enqueuing messages from web2 is working but not in web1?! The messages are stuck in web1 Outgoing Queues

Related

Failed to connect Winsoc socket in Windows 2012 MSMQ

I have a website uses enterprise library to log using MSMQ trace listener. Site is creating logs. The logs are in MSMQ outgoing queues. However, queues are not being sent to remote computer. Message I get is
Failed to connect Winsock socket. Address:IP=xx.xx.xx.xx
State is in "Waiting to Connect". The queue path I have as queuePath="FormatName:DIRECT=OS:computername\Private$\private queuename"
Am I missing anything? May be firewall rule? when I look at the firewall rule in destination computer, it allows the MSMQ Inbound TCP/UDP for all ports.
Enabling Remote Event Monitor (RPC-EPMAP) inbound rule in firewall fixed the issue I was getting. Now the state is Connected and Connection History is Connection is ready to transfer messages.
Also to add I found that port 1801 which msmq port for allowing incoming traffic need to be opened.
https://support.microsoft.com/en-us/help/183293/how-to-configure-a-firewall-for-msmq-access

Error Opening Queue, unrecognized error

I'm hoping someone will be able to help me with an issue we are having moving from Test to Production. In test everything is working fine but in Production we are having queue access problems.
Current configuration...
MSMQ queue server located on a work group machine located in DMZ
MSMQ message receiver machine located on a work group machine located off the internal domain
Wcf workflow services hosted in IIS on message receiver machine that monitor the MSMQ queue server
Private queues with names that match the end point of the Wcf workflow service and use the IP address of the queue server, i.e. net.msmq://[IP address]/private/workflowservice/service.xamlx
Net.MSMQ binding in IIS on receiving machine is configured to the IP address of the queue server
Net.MSMQ activator service on the receiving machine is running under NETWORK SERVICE
The receiving workflow services run using an application pool running under NETWORK SERVICE
ANONYMOUS LOGON and NETWORK SERVICE have full permissions on queues
MSMQ server Disable Unauthenticated RPC Calls is disabled
MSMQ installed on both machines
Firewalls are configured to allow ingoing and outgoing on all MSMQ ports
Can send to the queues successfully
If access one of the receiving workflow services via Internet Explorer I receive the following error message,
"An error occurred while opening the queue: Unrecognized error -1072824319 (0xc00e0001)."
I can see from the MSMQ Server machine security event log that the ANONYMOUS LOGON user is accessing the machine but the queue is not being recognised.
Any help would be greatly appreciated.

ARR The request cannot be routed because it has reached the Max-Forwards limit. The server may be self-referencing itself in request routing topology

I have two Windows 2008 R2 Standard Server on which IIS 7.5 is installed (Server1 and Server2). On Server1 I have installed Web Farm Framework 2.2 and created a server Farm "myFarm.com". I have also installed ARR on the Server1.
In the server farm, I have added Server2 and Server1 as the secondary servers. I have configured the ARR with default option. Load balancing is configured to "Round Robin so that request can go to both of the server randomly.
To test my setup I have created a Test.ASPX page and deployed it in both servers. This is a simple page which returns serverName on which server page is executed. This way I would know that load balancing is working or not.
Then I opened Internet Exlorer and tried to browse my Test.ASPX page from server1 which hosts Web Farm and ARR. Everytime I hit the page request goes to Server2 only. I made my server2 has unhealthy in the webfarm to check if Server1 handle the request or not. When I tried to hit the Test.aspx in the browser, I was surprised to add following error:
The request cannot be routed because it has reached the Max-Forwards limit. The server may be self-referencing itself in request routing topology.
From the error message it appears that when my server2 is not available ARR is sending the request to Server1 which is again sending it to itself causing loopback. I couldn't find a way to stop this loopback.
One of the solution which I found after searching is that I should not add Server1 to the web farm as it is hosting ARR, but I have only two servers and I don't want to use one server just for ARR.
As soon as I mark my server2 healthy request starts getting executed by server2.
Could someone suggest what should be configured to resolve this error?
Thanks
You can do a self reference ARR and avoid to get the max-fowards limits if you configure ARR on port 80 and your web farm on another port : ex 8080
So when ARR route the request to itself he will do it on another port so avoid to foward and foward again the request.
Enjoy :-)
I had the same problem recently and this is the configuration that helped me (following what Cedric suggested in another post).
So, here is what you can do:
In your web-site configuration, add additional binding for Server2, for example, to port 88 (i.e. you should be able to get response by navigating to http://Server2:88/Test.ASPX).
In your server farm configuration, add condition to your routing (Routing Rules -> URL Rewrite) to avoid processing requests that go to port 88:

NetMsmqBinding WAS service fails to read messages from remote MSMQ queue in a workgroup

We have a service that is hosted in IIS using WAS with the net.msmq binding. The service reads messages from a private transactional MSMQ queue. I need it to work by reading from a queue that is on a different machine to the service. I can get it working if the queue is on the same machine, but not if it is on a different machine.
Environment information
The servers are running Windows Web Server 2008 R2.
The servers are in a workgroup, i.e., they are not part of a domain.
MSMQ has been installed without the directory service integration feature.
I believe that the required Windows features are installed (WCF Non-Http Activation and Http Activation, Message Queuing Server, Multicasting Support, Message Queueing DCOM Proxy, Windows Process Activation Service, .NET Environment, Configuration APIs)
I have made the following registry changes on the machines:
NewRemoteReadServerAllowNoneSecurityClient = 1
NewRemoteReadServerDenyWorkgroupClient = 0
AllowNonauthenticatedRpc = 1
DTC has been enabled, with Network DTC Access, Allow Remote Clients, Allow Inbound, Allow Outbound, No Authentication Required and Enable SNA LU 6.2 Transactions all selected.
Firewall changes have been made.
Service configuration information
We are using netMsmqBinding.
The transport Security Mode of the netMsmqBinding is None.
ExactlyOnce is true
UseActiveDirectory is false
Durable is true
The queue address is net.msmq://the-host-computer-name/private/EmailAsyncService
WCF logging
There is a warning:
Cannot detect if the queue is transactional". The FormatName of the queue in the error is DIRECT=OS:the-host-computer-name\private$\EmailAsyncService
There is then an error:
An error occurred when converting the 'the-host-computer-name\private$\EmailAsyncService' > queue path name to the format name: Unrecognized error -1072824300 (0xc00e0014). All operations on the queued channel failed. Ensure that the queue address is valid. MSMQ must be installed with Active Directory integration enabled and access to it is available.
What I have tried
I can read messages from the remote queue from the machine the service is on if I manually create and use a MessageQueue instance.
I've tried hosting the service as a standalone console application. The error messages are the same.
I have tried disabling the firewalls involved.
I've tried the changes on http://msdn.microsoft.com/en-us/library/ms752246.aspx, which relate to running such services on a computer joined to a workgroup. ("both the activation service and the worker process must be run with a specific user account (must be same for both) and the queue must have ACLs for the specific user account... In workgroup, the service must also run using an unrestricted token.") The user account I'm currently using is Network Service.
Some thoughts
I don't believe that there is a firewall or permissions issue.
Despite the fact that the service configuration has UseActiveDirectory set to false, the queue address of net.msmq://the-host-computer-name/private/EmailAsyncService seems to be getting translated into the-host-computer-name\private$\EmailAsyncService, which AFAIK is a name format that requires lookup via Active Directory.
I'm a little late here, but since you have no other answers, I may still be of help.
You might want to try enabling Directory Service Integration, as I believe you need to muck with certificates to operate in Workgroup Mode.
Also, Juval Lowy's WCF book makes it clear that when you have queued services hosted in WAS you have to name the queue the exact same as the virtual path to your svc file. So if your service is actually hosted at /EmailAsyncService/EmailService.svc then that's precisely what you need to name your queue (without the first slash).

What Happens To MSMQ When Network Connection Lost

If I am using MSMQ over the web, what happens if the network connection is lost between client and server?
So can you still add messages to the Queue, and if so where are they stored? In the client app, or in the clients OS etc?
For instance if I have a windows service which is adding items to a queue in a different country. What if the network connection is lost, and the windows service is restarted. Do the messages get lost forever?
The other part of the question relates to the route that a message takes, is it sent directly to the receiving queue, or is it written into a queue on the client side? Does that require MSMQ to be installed on the sending server, and how about licensing for that?
Is there any good documentation to explain the required setup?
Update: Regarding your follow up question. Yes you have to install msmq on the sending server. There aren't any licensing cost, because MSMQ is part of windows and not a separate software (just like the IIS). Here is documentation on "Setting Up a Message Queue" on windwos 2003.
Before Update: Outgoing message are stored in the outgoing queue of the sending server. They are not lost if the sending service is restarted. They will wait in the outgoing queues ( which can be inspected with the msmq manager ) for I don't know how long.
if the msmq service or the sending server are restarted. Then "express" messages will be lost. express or recoverable are properties of non-transcriptional messages.