Help: OWSADM hangs when executing from C# web service

A

Abhi

Hi-

I'm trying to execute the C:\Program Files\Common Files\Microsoft
Shared\Web Server Extensions\50\bin\OWSADM.EXE programmatically from a
shell using the process.Start() method. I'm also impersonating as the
admin user and providing the login credentials through the
process.StartInfo.UserName and process.StartInfo.Password attributes.
I'm using ASP.NET 2.0 Beta 2.

Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files\Common
Files....\OWSADM.EXE";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;

process.StartInfo.Arguments = "-o install -p /LM/W3SVC/" + MyWebDir +
@" -u Admin"

process.StartInfo.UserName = "<Admin Name Here>";
process.StartInfo.Password = ConvertToSecureString("<Admin Password
Here>");
process.Start();
process.WaitForExit();
string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();


I've implemented ConvertToSecureString my self to convert a string into
a SecureString

private SecureString ConvertToSecureString(string str)
{
SecureString secureString = new SecureString();
foreach (char c in str)
{
secureString.AppendChar(c);
}
return secureString;
}


For some reason when I execute the Start() method then the OWSADM hangs
in memory. It does not return any error code or any other output. If I
provide an invalid password then it complains about login failures.

The same command works fine if I choose to run it directly from the
command prompt on that machine. However it does not run from my C# web
method.

The machine is running Windows Server 2003 Enterprise edition. (3.06
GHz, 4 GB of RAM!)


Note: When looking at the hung process"OWSADM" using Process Explorer I
see that there's this KeyedEvent
"\KernelObjects\CritSecOutOfMemoryEvent"

Any help will be greatly appreciated.
Thanks!
-abhi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,108
Latest member
AlbertEste
Top