2010-11-16 27 views
0

Mon service iis appelle une application de console. Cette application de console référence une DLL.Appel de l'application de console à partir du service Web IIS, sans chargement des DLL

Quand je vérifie la sortie d'erreur que je reçois ceci:

Impossible de charger le fichier ou l'assembly 'file: /// c: \ windows \ system32 \ inetsrv \ MyDll.dll'

Quelle est la manière correcte d'appeler l'exécutable:

jusqu'à présent, je l'ai essayé ceci:

using (var p = new System.Diagnostics.Process()) 
      { 
       p.StartInfo.UseShellExecute = false; 
       p.StartInfo.RedirectStandardOutput = true; 
       p.StartInfo.RedirectStandardError = true; 
       p.StartInfo.RedirectStandardInput = true; 
       p.StartInfo.FileName = downloaderPath; 
       p.Start(); 
       string o = p.StandardOutput.ReadToEnd(); 
       string i = p.StandardError.ReadToEnd(); 
       p.WaitForExit(); 
      } 

Répondre

1

Ajouter cette ligne:

p.StartInfo.WorkingDirectory = Path.GetDirectoryName(downloaderPath); 
1

Ajouter ceci:

p.StartInfo.WorkingDirectory = "c:\mydir\"; 

Si vous n'êtes pas, l'exécutable sera lancé à partir du répertoire où IIS est en cours d'exécution (c: \ windows \ system32 \ inetsrv).