Question

we are using some private MSMQ queues with our production system. Since implementing, we've had to update some stuff with the queues and re-create them to work with updated code. We have over 200 machines that need these updates so I'm working on a program that will be pushed via SMS to do this update.

What I'm noticing is that the only person that can run my program to do the update is the one that originally setup the private queue on that particular machine. Because of the number of machines, there were multiple admins that setup these queues.

Since not all of the employees still work here, this is causing me [my program] a problem. The permissions are not allowing the program to update everything that I need. I googled and found this link http://social.msdn.microsoft.com/Forums/hu-HU/msmq/thread/36a3d910-d533-4af3-86dc-498d00c68fef that shows how to update the permissions by modifying the file that is created for each of the queues. Great! It works when I manually navigate to that path and do the update. Now I want to do it programmatically via SMS push.

When trying to run this from my program, I get an error back saying the directory does not exist "C:\Windows\System32\msmq\storage\lqs". Huh? When I enter that path into Start->Run, it brings up the folder just fine. Well, breaking on the if (Directory.Exists(path)) part of my code definitely returns a false. If I remove all of the folders beyond System32, then the Directory.Exsts works just fine.

Why can't my program determine whether or not that msmq folder exists? I've tried "running as administrator" and it still returns false. What do I need to do to get that check to work?

Thanks

Edit: This is really weird, I have a FindAndReplace API that I wrote that will take in a path (file or directory), find text, replace text, etc. When I'm running that program from my Find And Replace GUI wrapper, it works just fine. But when I'm calling this API from my update program, it says that directory doesn't exist. This is really confusing. (I should probably remove the MSMQ tag because it has nothing to do with my question...)

Was it helpful?

Solution

Project + Properties, Build tab. Change the "Target platform" setting from x86 to AnyCPU. This lets you program run in 64-mode so the c:\windows\system32 directory search doesn't get redirected to c:\windows\syswow64.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top