Ask a Question related to ASP.NET Security, Design and Development.
-
Royston #1
IIS Reset thru Web access denied in Window 2003
I tried to reset IIS thru Web using the following code
ProcessStartInfo si = new ProcessStartInfo("cmd.exe");
// Redirect both streams so we can write/read them.
si.RedirectStandardInput = true;
si.RedirectStandardOutput = true;
si.UseShellExecute = false;
// Start the procses.
Process p = Process.Start(si);
p.StandardInput.WriteLine("iisreset","/restart");
p.StandardInput.WriteLine("exit");
// Read all the output generated from it.
string output = p.StandardOutput.ReadToEnd();
StreamWriter writer = new StreamWriter(alertLog, true, Encoding.UTF8);
writer.WriteLine(DateTime.Now + ": \"" + output);
writer.Close();
The code work in Windows 2000 server, the output is
Attempting stop...
Internet services successfully stopped
Attempting start...
Internet services successfully restarted
but when I run the code in Windows 2003 Enterprise Edition, the iisreset
don't work and I get
1/12/2005 3:33:24 PM: "Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.
c:\windows\system32\inetsrv>iisreset
Access denied, you must be an administrator of the remote computer to use
this
command. Either have your account added to the administrator local group of
the remote computer or to the domain administrator global group.
c:\windows\system32\inetsrv>exit
Do anyone know how to solve this?
Royston Guest
-
Ext Manager - how do you reset window location?
quite a silly one, but very annoying: had twin monitors, now got one only. when I open the extension manager, it opens off the viewable screen... -
Window 2003 Environment issue - Component Access error
Hi all, An application which is working perfectly in Windows 2000 Server is now installed in Window 2003 Server. A component (VB Component)... -
ACCESS DENIED between 2003 and NT 4.0
I have two domains, one is Server 2003 (called "ALPHA") with active directory, the other is NT 4.0 (Called "BETA"). I have set up a two way trust... -
How to reset activation data to reativate a Windows 2003 Server
Hi How to reset activation data to reativate a Windows 2003 Server ? (The system says that activation is corrupted at logon and needs to... -
Access denied when creating Access application object
In an ASP file I am running the following in VBScript in order to extract data from an Access 2002 MDB file which is physically located in the... -
Joe Kaplan \(MVP - ADSI\) #2
Re: IIS Reset thru Web access denied in Window 2003
Are you sure the current ASP.NET worker process is running as an
administrator? That seems like the most likely cause of the problem.
Under 2003, they are usually run under NETWORK SERVICE.
Joe K.
"Royston" <royston@earth9.com> wrote in message
news:Ob$ZWZR%23EHA.2876@TK2MSFTNGP12.phx.gbl...>I tried to reset IIS thru Web using the following code
>
> ProcessStartInfo si = new ProcessStartInfo("cmd.exe");
> // Redirect both streams so we can write/read them.
> si.RedirectStandardInput = true;
> si.RedirectStandardOutput = true;
> si.UseShellExecute = false;
> // Start the procses.
> Process p = Process.Start(si);
> p.StandardInput.WriteLine("iisreset","/restart");
> p.StandardInput.WriteLine("exit");
> // Read all the output generated from it.
> string output = p.StandardOutput.ReadToEnd();
>
> StreamWriter writer = new StreamWriter(alertLog, true, Encoding.UTF8);
> writer.WriteLine(DateTime.Now + ": \"" + output);
> writer.Close();
>
> The code work in Windows 2000 server, the output is
> Attempting stop...
> Internet services successfully stopped
> Attempting start...
> Internet services successfully restarted
>
> but when I run the code in Windows 2003 Enterprise Edition, the iisreset
> don't work and I get
> 1/12/2005 3:33:24 PM: "Microsoft Windows [Version 5.2.3790]
> (C) Copyright 1985-2003 Microsoft Corp.
>
> c:\windows\system32\inetsrv>iisreset
>
> Access denied, you must be an administrator of the remote computer to use
> this
>
> command. Either have your account added to the administrator local group
> of
>
> the remote computer or to the domain administrator global group.
>
>
> c:\windows\system32\inetsrv>exit
>
> Do anyone know how to solve this?
>
>
Joe Kaplan \(MVP - ADSI\) Guest
-
Royston #3
Re: IIS Reset thru Web access denied in Window 2003
I have found that this method will not work as when System.Diagnostics start
a new process, the process always inherits the security context of the
parent process. Even if the ASP.NET thread invoking the Start method is
impersonating a client, the Process still starts with the ASP.NET worker
process credentials
I have worked around this using DuplicateTokenEx & CreateProcessAsUser win32
api (refer to [url]http://odetocode.com/Blogs/scott/archive/2004/10/28/602.aspx[/url]).
However, this solution work in window 2003 but fail in window 2000 (I get
1314 error when running this on a Window 2000 machine)
"Royston" <royston@earth9.com> wrote in message
news:Ob$ZWZR%23EHA.2876@TK2MSFTNGP12.phx.gbl...of> I tried to reset IIS thru Web using the following code
>
> ProcessStartInfo si = new ProcessStartInfo("cmd.exe");
> // Redirect both streams so we can write/read them.
> si.RedirectStandardInput = true;
> si.RedirectStandardOutput = true;
> si.UseShellExecute = false;
> // Start the procses.
> Process p = Process.Start(si);
> p.StandardInput.WriteLine("iisreset","/restart");
> p.StandardInput.WriteLine("exit");
> // Read all the output generated from it.
> string output = p.StandardOutput.ReadToEnd();
>
> StreamWriter writer = new StreamWriter(alertLog, true, Encoding.UTF8);
> writer.WriteLine(DateTime.Now + ": \"" + output);
> writer.Close();
>
> The code work in Windows 2000 server, the output is
> Attempting stop...
> Internet services successfully stopped
> Attempting start...
> Internet services successfully restarted
>
> but when I run the code in Windows 2003 Enterprise Edition, the iisreset
> don't work and I get
> 1/12/2005 3:33:24 PM: "Microsoft Windows [Version 5.2.3790]
> (C) Copyright 1985-2003 Microsoft Corp.
>
> c:\windows\system32\inetsrv>iisreset
>
> Access denied, you must be an administrator of the remote computer to use
> this
>
> command. Either have your account added to the administrator local group>
> the remote computer or to the domain administrator global group.
>
>
> c:\windows\system32\inetsrv>exit
>
> Do anyone know how to solve this?
>
>
Royston Guest
-
Joe Kaplan \(MVP - ADSI\) #4
Re: IIS Reset thru Web access denied in Window 2003
Right, the 1314 is something like "a needed privilege is not held by the
client". This is because you need to have the SE_TCB_NAME privilege to call
LogonUser or CreateProcessAsUser under Windows 2000, and generally that is
only given to the SYSTEM account.
This is a very common issue on Windows 2000.
Joe K.
"Royston" <royston@earth9.com> wrote in message
news:ut6RIBj%23EHA.3840@tk2msftngp13.phx.gbl...>I have found that this method will not work as when System.Diagnostics
>start
> a new process, the process always inherits the security context of the
> parent process. Even if the ASP.NET thread invoking the Start method is
> impersonating a client, the Process still starts with the ASP.NET worker
> process credentials
>
> I have worked around this using DuplicateTokenEx & CreateProcessAsUser
> win32
> api (refer to
> [url]http://odetocode.com/Blogs/scott/archive/2004/10/28/602.aspx[/url]).
> However, this solution work in window 2003 but fail in window 2000 (I get
> 1314 error when running this on a Window 2000 machine)
>
> "Royston" <royston@earth9.com> wrote in message
> news:Ob$ZWZR%23EHA.2876@TK2MSFTNGP12.phx.gbl...> of>> I tried to reset IIS thru Web using the following code
>>
>> ProcessStartInfo si = new ProcessStartInfo("cmd.exe");
>> // Redirect both streams so we can write/read them.
>> si.RedirectStandardInput = true;
>> si.RedirectStandardOutput = true;
>> si.UseShellExecute = false;
>> // Start the procses.
>> Process p = Process.Start(si);
>> p.StandardInput.WriteLine("iisreset","/restart");
>> p.StandardInput.WriteLine("exit");
>> // Read all the output generated from it.
>> string output = p.StandardOutput.ReadToEnd();
>>
>> StreamWriter writer = new StreamWriter(alertLog, true, Encoding.UTF8);
>> writer.WriteLine(DateTime.Now + ": \"" + output);
>> writer.Close();
>>
>> The code work in Windows 2000 server, the output is
>> Attempting stop...
>> Internet services successfully stopped
>> Attempting start...
>> Internet services successfully restarted
>>
>> but when I run the code in Windows 2003 Enterprise Edition, the iisreset
>> don't work and I get
>> 1/12/2005 3:33:24 PM: "Microsoft Windows [Version 5.2.3790]
>> (C) Copyright 1985-2003 Microsoft Corp.
>>
>> c:\windows\system32\inetsrv>iisreset
>>
>> Access denied, you must be an administrator of the remote computer to use
>> this
>>
>> command. Either have your account added to the administrator local group>>>
>> the remote computer or to the domain administrator global group.
>>
>>
>> c:\windows\system32\inetsrv>exit
>>
>> Do anyone know how to solve this?
>>
>>
>
Joe Kaplan \(MVP - ADSI\) Guest



Reply With Quote

