browsermob proxy.NET System.Diagnostics.Process causes "32 bit processes cannot access modules of a 64 bit process" error

StackOverflow https://stackoverflow.com/questions/21347112

Question

I have a pc with win7 x64 with VS2013 installed and I have an instance of Win Server 2012 with VS2013 installed as well. I am trying to get BrowserMob Proxy.NET working on the server for a JEnkins/Selenium install I am running. When I run AutomatedTester.BrowserMob's Server.Start located in the Server.cs file and it instantiates a Process object, I get an error stating: "32 bit processes cannot access modules of a 64 bit process" which has a NativeErrorCode of 299 stating: Only part of a ReadProcessMemory or WriteProcessMemory request was completed.

Now if I run it on my Win7 x64 box, it works jsut fine, but when I run the same thing on my Server 2012 box, it is throwing the above error. I am running IIS8 on server where IIS7 is running on windows 7. IF anyone has any ideas on what I may be able to do, please post :) I have built the project using 4.5 framework and "Any CPU" selected.

What Im concerned about is that this worked fine on my local pc but it isnt running on the server. I am worried that I am tracking this down as a specific architecture issue and maybe it is some security setting or something im unaware of. One more piece of info is this Windows 2012 Server is running on AWS. I have posted the block of code below that this is happening with. Thanks everyone!

try
{
var _serverProcess = new Process
{
StartInfo = { FileName = pathToBrowserMobProxy }
};
}
catch (System.ComponentModel.Win32Exception e)
{
throw e;             
}
Was it helpful?

Solution

This was due to the NewtonSoft Json.net lib reference being an x32 version that came with the AutomatedTester BrowserserMob wrapper and my box being x64. I removed the reference to the x32 version of newtonsoft and added the Nuget newtonsoft package/reference. Once I did this I was finally able to get the command window to open and the browsermob proxy to run. I did then run into a little issue with MSTest only running as x32, which I guess is the way it is supposed to work. So in Jenkins I setup the VSTest Runner plugin and had this run the tests and everything now works fine. Hope this helps someone one day.

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