Help: OWSADM hangs when executing from C# web service



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.

Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files\Common
Files....\WSADM.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 does complain 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 or RAM!)

Any help will be greatly appreciated.
Thanks!

.



Relevant Pages

  • Help: OWSADM hangs when executing from C# web service
    ... admin user and providing the login credentials through the ... string output = process.StandardOutput.ReadToEnd; ... For some reason when I execute the Startmethod then the OWSADM hangs ... The machine is running Windows Server 2003 Enterprise edition. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • System.Diagnostics.Process() hangs
    ... Now I have to develop a webservice which is run on the server. ... webservice will need to invoke an exe (which is a server application ... public string CreateTSUser ... SecureString securePass = new SecureString; ...
    (microsoft.public.dotnet.framework.aspnet)