Help: OWSADM hangs when executing from C# web service

From: Abhi (kulkarna_at_gmail.com)
Date: 05/23/05


Date: 23 May 2005 14:22:51 -0700

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



Relevant Pages

  • Impersonate second session require restart of IIS
    ... 2000 Server with latest security pacx and service pacs) ... Cannot execute a program. ... (IntPtr userToken, String cmd, String currentDir, ... (CompilerParameters options, String compilerDirectory, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: DirectoryEntry.Invoke("SetPassword") slow
    ... It could be related to an SSL problem on the server. ... > or two to execute: ... > public void AddUser(string userName, string domain, string firstName, ...
    (microsoft.public.dotnet.framework)
  • Re: gute Beschreibung zu DdeClientTransaction()
    ... DDE- Server aus dem Client heraus starte. ... Server noch keine "execute" Anfragen akzeptieren ... Wo soll den die Länge vom String angegeben werden? ... HDDEDATA hData = DdeCreateDataHandleszCommand, ...
    (microsoft.public.de.vc)
  • Dynamic compilation errors
    ... Timed out waiting for a program to execute. ... userToken, String cmd, String currentDir, TempFileCollection tempFiles, ... String cmd, String currentDir, TempFileCollection tempFiles, String& ... people suggest it involves IISLockdown which we have on our server. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Help: OWSADM hangs when executing from C# web service
    ... admin user and providing the login credentials through the ... private SecureString ConvertToSecureString ... For some reason when I execute the Startmethod then the OWSADM hangs ... The machine is running Windows Server 2003 Enterprise edition. ...
    (microsoft.public.dotnet.languages.csharp)