469,924 Members | 1,361 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,924 developers. It's quick & easy.

"Application failed to intialize" with CreateProcessWithLogon

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 ?

Apr 11 '06 #1
6 3038
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

--
Mattias SjŲgren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Apr 11 '06 #2

"Steve4D" <St*****@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.com...
| 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.
Apr 11 '06 #3
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 :

"Steve4D" <St*****@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.com...
| 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.

Apr 12 '06 #4
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.

"Steve4D" <St*****@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
|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 :
|
| >
| > "Steve4D" <St*****@discussions.microsoft.com> wrote in message
| > news:D2**********************************@microsof t.com...
| > | 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.
| >
| >
| >
Apr 12 '06 #5
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.

"Steve4D" <St*****@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
|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 :
|
| >
| > "Steve4D" <St*****@discussions.microsoft.com> wrote in message
| > news:D2**********************************@microsof t.com...
| > | 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.
| >
| >
| >

Apr 13 '06 #6
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.

"Steve4D" <St*****@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
| 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.
| >
| > "Steve4D" <St*****@discussions.microsoft.com> wrote in message
| > news:D9**********************************@microsof t.com...
| > |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 :
| > |
| > | >
| > | > "Steve4D" <St*****@discussions.microsoft.com> wrote in message
| > | > news:D2**********************************@microsof t.com...
| > | > | 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.
| > | >
| > | >
| > | >
| >
| >
| >
Apr 13 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by New MSSQL DBA | last post: by
reply views Thread by sa6113 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.