"Application failed to intialize" with CreateProcessWithLogon

G

Guest

With an ASP.NET application, I try to run an external program (like EXE, BAT)
with a logon of an another user. I use CreateProcessWithLogonW from API
"advapi32.dll" . When my ASP.NET application launches my EXE program via
CreateProcessWithLogonW, the process starts but an error appears "Application
failed to initialze" : why ?
 
M

Mattias Sjögren

When my ASP.NET application launches my EXE program via
CreateProcessWithLogonW, the process starts but an error appears "Application
failed to initialze" : why ?

Alsmost impossible to say without knowing more about the applications,
seeing your calling code etc.


Mattias
 
W

Willy Denoyette [MVP]

| With an ASP.NET application, I try to run an external program (like EXE,
BAT)
| with a logon of an another user. I use CreateProcessWithLogonW from API
| "advapi32.dll" . When my ASP.NET application launches my EXE program via
| CreateProcessWithLogonW, the process starts but an error appears
"Application
| failed to initialze" : why ?
|

A few question, what are you trying to achieve by this? If you are trying to
launch an interactive process using this API, you better stop here as it
won't work anyway.

If you are just trying to launch a background process using alternate
credentials;
What is the identity of the ASP.NET process?
Note that you can't use localsystem (SYSTEM) to call
CreateProcessWithLogonW.
What's the value of startInfo.lpDesktop?
What is the value of the dwLogonFlags argument?

Willy.
 
G

Guest

I use IIS 6 under Windows2003 Server.
The Framework.Net version is 1.1.4322 .
My server is in the domain Domain_1.
I try to launch a background process using alternate credentials with the
login Domain_1\ProcessUser. The process is a simple c# program.
The identity of the ASP.Net process is defined with the login
Domain_1\ASPUser.
The value of StartUpInfo.lpDesktop is NULL.
The value of dwLogonFlags is LOGON_NETCREDENTIALS_ONLY .

Steve.


"Willy Denoyette [MVP]" a écrit :
 
W

Willy Denoyette [MVP]

Ok, but what kind of application is this (the simple C#), don't forget that
the error comes from this application that fails to initialize.
What happens if you run this from a console application?

Willy.

|I use IIS 6 under Windows2003 Server.
| The Framework.Net version is 1.1.4322 .
| My server is in the domain Domain_1.
| I try to launch a background process using alternate credentials with the
| login Domain_1\ProcessUser. The process is a simple c# program.
| The identity of the ASP.Net process is defined with the login
| Domain_1\ASPUser.
| The value of StartUpInfo.lpDesktop is NULL.
| The value of dwLogonFlags is LOGON_NETCREDENTIALS_ONLY .
|
| Steve.
|
|
| "Willy Denoyette [MVP]" a écrit :
|
| >
| > | > | With an ASP.NET application, I try to run an external program (like
EXE,
| > BAT)
| > | with a logon of an another user. I use CreateProcessWithLogonW from
API
| > | "advapi32.dll" . When my ASP.NET application launches my EXE program
via
| > | CreateProcessWithLogonW, the process starts but an error appears
| > "Application
| > | failed to initialze" : why ?
| > |
| >
| > A few question, what are you trying to achieve by this? If you are
trying to
| > launch an interactive process using this API, you better stop here as it
| > won't work anyway.
| >
| > If you are just trying to launch a background process using alternate
| > credentials;
| > What is the identity of the ASP.NET process?
| > Note that you can't use localsystem (SYSTEM) to call
| > CreateProcessWithLogonW.
| > What's the value of startInfo.lpDesktop?
| > What is the value of the dwLogonFlags argument?
| >
| > Willy.
| >
| >
| >
 
G

Guest

When I run this from a console application: there is no error.
We develop on WindowsXP SP2: there is no error with our Web developement
configuration.
On our server W2003, the ASP.Net application creates the process with the
simple c# program and there the error appears. In the Windows tasks list, we
can see the new process.
We made the test with C# program with no code inside: we have the same error
 
W

Willy Denoyette [MVP]

Can you try to Logon as Domain_1\ASPUser on W2K3 (this is the account your
asp.net worker process runs as), and run the console program like as you did
on XP.
You also need to check the return code of CreateProcessWithLogonW, make sure
SetLastError is true like...

[DllImport("advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
internal static extern bool CreateProcessWithLogonW(
....

When it fails, do you get a dialog box with a message "...Failed to
Initilaize Error 0xc0000142"?

Willy.

| When I run this from a console application: there is no error.
| We develop on WindowsXP SP2: there is no error with our Web developement
| configuration.
| On our server W2003, the ASP.Net application creates the process with the
| simple c# program and there the error appears. In the Windows tasks list,
we
| can see the new process.
| We made the test with C# program with no code inside: we have the same
error
| on server W2003.
|
| "Willy Denoyette [MVP]" a écrit :
|
| > Ok, but what kind of application is this (the simple C#), don't forget
that
| > the error comes from this application that fails to initialize.
| > What happens if you run this from a console application?
| >
| > Willy.
| >
| > | > |I use IIS 6 under Windows2003 Server.
| > | The Framework.Net version is 1.1.4322 .
| > | My server is in the domain Domain_1.
| > | I try to launch a background process using alternate credentials with
the
| > | login Domain_1\ProcessUser. The process is a simple c# program.
| > | The identity of the ASP.Net process is defined with the login
| > | Domain_1\ASPUser.
| > | The value of StartUpInfo.lpDesktop is NULL.
| > | The value of dwLogonFlags is LOGON_NETCREDENTIALS_ONLY .
| > |
| > | Steve.
| > |
| > |
| > | "Willy Denoyette [MVP]" a Ãf©crit :
| > |
| > | >
| > | > | > | > | With an ASP.NET application, I try to run an external program
(like
| > EXE,
| > | > BAT)
| > | > | with a logon of an another user. I use CreateProcessWithLogonW
from
| > API
| > | > | "advapi32.dll" . When my ASP.NET application launches my EXE
program
| > via
| > | > | CreateProcessWithLogonW, the process starts but an error appears
| > | > "Application
| > | > | failed to initialze" : why ?
| > | > |
| > | >
| > | > A few question, what are you trying to achieve by this? If you are
| > trying to
| > | > launch an interactive process using this API, you better stop here
as it
| > | > won't work anyway.
| > | >
| > | > If you are just trying to launch a background process using
alternate
| > | > credentials;
| > | > What is the identity of the ASP.NET process?
| > | > Note that you can't use localsystem (SYSTEM) to call
| > | > CreateProcessWithLogonW.
| > | > What's the value of startInfo.lpDesktop?
| > | > What is the value of the dwLogonFlags argument?
| > | >
| > | > Willy.
| > | >
| > | >
| > | >
| >
| >
| >
 

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

Top