Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2007

Tip: Looking for answers? Try searching our database.

ASP.Net problem with process.start

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve B. - 08 Jun 2007 13:44 GMT
Hi,

I've build a custom web service that is used to digitally signed cab files
that are used to install smart devices application.
Using a standard Process.start and processstartinfo pattern, I run this
command line :

filename :
c:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\signtool.exe

command line arguments :
sign /f "c:\test\mykey.pfx" -p "password" /v "c:\temp\cabfiletosign.cab"

When this process is executed, and even if the files actually exist (I've
check many times), I get the following error (from the standarderror stream
of the process object) :

--------------------------------------------------
Number of files successfully Signed: 0

Number of warnings: 0

Number of errors: 1

SignTool Error: File not found: c:\test\mykey.pfx
--------------------------------------------------

If I run exactly the same code (a class lib that is referenced in the WS)
from a windows desktop application, I get the following behavior :

--------------------------------------------------
The following certificate was selected:
Issued to: Our company
Issued by: the company
Expires: 01/01/2009 01:59:59
SHA1 hash: the hash

Done Adding Additional Store

Attempting to sign: c:\temp\cabfiletosign.cab
Successfully signed: c:\temp\cabfiletosign.cab

Number of files successfully Signed: 1
Number of warnings: 0
Number of errors: 0
--------------------------------------------------

I've set up IIS 6 to make the web service run with a specific user with it's
own app pool. I've also check that the web service's user can access to all
files that are needed..

Does anybody have an idea about this difference ?
Is there any env variable that could cause ASP.Net web apps to work
differently ?

Thanks in advance,
Steve
Vadym Stetsyak - 08 Jun 2007 14:17 GMT
Hello, Steve!

ASP.NET and common destop app can have different working directories.

Try to set UserShellExcute to false and see what will happen.

You wrote  on Fri, 8 Jun 2007 14:44:25 +0200:

SB> Hi,

SB> I've build a custom web service that is used to digitally signed cab
SB> files
SB> that are used to install smart devices application.
SB> Using a standard Process.start and processstartinfo pattern, I run
SB> this
SB> command line :

SB> filename :
SB> c:\Program Files (x86)\Microsoft Visual Studio
SB> 8\Common7\Tools\Bin\signtool.exe

SB> command line arguments :
SB> sign /f "c:\test\mykey.pfx" -p "password" /v
SB> "c:\temp\cabfiletosign.cab"

SB> When this process is executed, and even if the files actually exist
SB> (I've
SB> check many times), I get the following error (from the standarderror
SB> stream
SB> of the process object) :

SB> --------------------------------------------------
SB> Number of files successfully Signed: 0

SB> Number of warnings: 0

SB> Number of errors: 1

SB> SignTool Error: File not found: c:\test\mykey.pfx
SB> --------------------------------------------------

SB> If I run exactly the same code (a class lib that is referenced in
SB> the WS)
SB> from a windows desktop application, I get the following behavior :

SB> --------------------------------------------------
SB> The following certificate was selected:
SB> Issued to: Our company
SB> Issued by: the company
SB> Expires: 01/01/2009 01:59:59
SB> SHA1 hash: the hash

SB> Done Adding Additional Store

SB> Attempting to sign: c:\temp\cabfiletosign.cab
SB> Successfully signed: c:\temp\cabfiletosign.cab

SB> Number of files successfully Signed: 1
SB> Number of warnings: 0
SB> Number of errors: 0
SB> --------------------------------------------------

SB> I've set up IIS 6 to make the web service run with a specific user
SB> with it's
SB> own app pool. I've also check that the web service's user can access
SB> to all
SB> files that are needed..

SB> Does anybody have an idea about this difference ?
SB> Is there any env variable that could cause ASP.Net web apps to work
SB> differently ?

SB> Thanks in advance,
SB> Steve

With best regards, Vadym Stetsyak.
Blog: http://vadmyst.blogspot.com
Steve B. - 08 Jun 2007 14:38 GMT
Since I'm using full path and not relative path, I don't think this could be
a working directory problem.

Here is the process.start wrapper I wrote to launch the signtool.exe process

---------------------------------------------------------------------------
public static string StartProcessAndGetOutput(
string fileName,
bool runInFileNameDirectory,
string arguments
)
{
string log;
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = fileName;
psi.Arguments = arguments;
if (runInFileNameDirectory) psi.WorkingDirectory =
Path.GetDirectoryName(fileName);
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
StringBuilder sbLog = new StringBuilder();
using (Process p = Process.Start(psi))
{
string output = string.Empty;
while ((output = p.StandardOutput.ReadLine()) != null)
{
sbLog.AppendLine(output);
}
sbLog.Append(p.StandardOutput.ReadToEnd());
sbLog.Append(p.StandardError.ReadToEnd());
p.WaitForExit();
}
log = sbLog.ToString();
return log;
}
---------------------------------------------------------------------------
As you can see, I disable UseShellExecute, and I also added a parameter that
allow me to specify if the working directory is the filename directory.

You can also notice that the error message  returns the full path of the
targeted file... which is correct.

Thanks,
Steve

> Hello, Steve!
>
[quoted text clipped - 73 lines]
> With best regards, Vadym Stetsyak.
> Blog: http://vadmyst.blogspot.com
Mehdi - 08 Jun 2007 15:36 GMT
> As you can see, I disable UseShellExecute, and I also added a parameter that
> allow me to specify if the working directory is the filename directory.
>
> You can also notice that the error message  returns the full path of the
> targeted file... which is correct.

I'm sure that you've already checked that but are you sure that the file
you are trying to sign is really placed on the machine on which the Web
Service runs (the web server) and not on the machine on which you are
accessing it the web service.
Steve B. - 08 Jun 2007 15:54 GMT
The web service is running in the developpement computer...

thx

>> As you can see, I disable UseShellExecute, and I also added a parameter
>> that
[quoted text clipped - 7 lines]
> Service runs (the web server) and not on the machine on which you are
> accessing it the web service.
Henning Krause [MVP - Exchange] - 09 Jun 2007 10:19 GMT
Hello Steve,

the program may need access to a temporary files folder. I'd suggest you get
FileMon from Microsoft (formerly Sysinternals) and check for Access denied
messages.

Best regards,
Henning Krause

> Hi,
>
[quoted text clipped - 54 lines]
> Thanks in advance,
> Steve
Steve B. - 11 Jun 2007 09:44 GMT
Thanks all for your feedbacks but I finnally "unblocked" the situation...

I reset the password of the user that runs the app pool (to the same
password !!!, app pools worked and continued to work), and at this point,
the web service started to work properly.

I can't find any explanation of this "magic" behaviour... but it's working
now.

Thanks for all people that tried to help me !

Steve

> Hi,
>
[quoted text clipped - 54 lines]
> Thanks in advance,
> Steve
Steve B. - 11 Jun 2007 10:32 GMT
Hum... the problem is still present (hope failed)...

I don't know if it can help, but here is the PATH variable :

-------------------------------------------------------------
E:\WINDOWS\system32
E:\WINDOWS
E:\WINDOWS\System32\Wbem
E:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\
E:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn\
E:\Program Files\Microsoft SQL Server\90\DTS\Binn\
E:\Program Files\Microsoft SQL Server\90\Tools\binn\
E:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\
E:\Program Files (x86)\Microsoft SQL
Server\90\Tools\Binn\VSShell\Common7\IDE\
E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\IDE\PrivateAssemblies\
E:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\
E:\Program Files (x86)\Common Files\Roxio Shared\9.0\DLLShared\
E:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\
-------------------------------------------------------------

And the filemon result (only failures) :
-------------------------------------------------------------
E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\signtool.exe.Manifest
NOT FOUND
Options: Open  Access: 001200A9

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\signtool.exe.Local
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\wow64log.dll
NOT FOUND
Attributes: Error

E:\WINDOWS\system32\wow64log.dll
NOT FOUND
Attributes: Error

E:\WINDOWS\system\wow64log.dll
NOT FOUND
Attributes: Error

E:\WINDOWS\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\wow64log.dll
NOT FOUND
Attributes: Error

E:\WINDOWS\system32\wow64log.dll
NOT FOUND
Attributes: Error

E:\WINDOWS\wow64log.dll
NOT FOUND
Attributes: Error

E:\WINDOWS\System32\Wbem\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files\Microsoft SQL Server\90\DTS\Binn\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files\Microsoft SQL Server\90\Tools\binn\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft SQL
Server\90\Tools\Binn\VSShell\Common7\IDE\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\IDE\PrivateAssemblies\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Common Files\Roxio Shared\9.0\DLLShared\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files\Common Files\Microsoft Shared\Web Server
Extensions\12\bin\wow64log.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\signtool.exe.Local
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\signtool.exe
ACCESS DENIED
computer\apppool_user

E:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools\Bin\MFC42.DLL
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\WSOCK32.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\WS2_32.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\WS2HELP.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\ODBC32.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\signtool.exe.Local\
NOT FOUND
Attributes: Error

E:\WINDOWS\syswow64\CRYPTUI.dll.2.Config
NOT FOUND
Options: Open  Access: 001200A9

E:\WINDOWS\syswow64\WININET.dll.123.Config
NOT FOUND
Options: Open  Access: 001200A9

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\signtool.exe.Local\
NOT FOUND
Attributes: Error

E:\WINDOWS\WindowsShell.Config
NOT FOUND
Options: Open  Access: 001200A9

E:\WINDOWS\syswow64\SHELL32.dll.124.Config
NOT FOUND
Options: Open  Access: 001200A9

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\signtool.exe.Local\
NOT FOUND
Attributes: Error

E:\WINDOWS\SysWOW64\MFC42LOC.DLL
NOT FOUND
Attributes: Error

E:\WINDOWS\SysWOW64\MFC42LOC.DLL
NOT FOUND
Attributes: Error

E:\WINDOWS\SysWOW64\MFC42LOC.DLL.DLL
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\signtool.exe.Local\
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\RichEd20.dll
NOT FOUND
Attributes: Error

E:\WINDOWS\SysWOW64\rpcss.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\uxtheme.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\CLBCatQ.DLL
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\COMRes.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft CAPICOM 2.1.0.2\Lib\X86\MSSIGN32.dll
NOT FOUNDAttributes: Error

E:\WINDOWS\SysWOW64\MSSIGN32.dll.2.Config
NOT FOUND
Options: Open  Access: 001200A9

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\rsaenh.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\rsaenh.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\rsaenh.dll
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools\Bin\PSAPI.DLL
NOT FOUND
Attributes: Error

E:\Program Files (x86)\Microsoft Visual Studio
8\Common7\Tools\Bin\USERENV.dll
NOT FOUND
Attributes: Error

E:\WINDOWS\debug\UserMode\ChkAcc.log
ACCESS DENIED
computer\apppool_user

E:\WINDOWS\debug\UserMode\ChkAcc.log
ACCESS DENIED
computer\apppool_user

-------------------------------------------------------------

> Thanks all for your feedbacks but I finnally "unblocked" the situation...
>
[quoted text clipped - 67 lines]
>> Thanks in advance,
>> Steve

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.