Bonjour

Voici ma situation, je debute en C# et je dois exploiter la metabase de IIS d'un serveur distant avec DirectoryEntry.
Mon code fonctionne avec localhost, mais pas à distance.

Mon code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
string provider = @"IIS://192.168.1.150/w3svc";
DirectoryEntry root = new  DirectoryEntry(provider);                   
Console.WriteLine(root.Name); // Mon exception arrive ici
Peut-être que quelqu'un a eu un problème similaire.

Merci pour vos réponses.

Ci dessous le rapport de debugage:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
L'exception System.Runtime.InteropServices.COMException n'a pas été gérée
  Message="Accès refusé.\r\n"
  Source="System.DirectoryServices"
  ErrorCode=-2147024891
  StackTrace:
       à System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
       à System.DirectoryServices.DirectoryEntry.Bind()
       à System.DirectoryServices.DirectoryEntry.get_Name()
       à ConsoleApplication1.Program.listNomSite(DirectoryEntry root) dans C:\Documents and Settings\christophe\Mes documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:ligne 139
       à ConsoleApplication1.Program.Main(String[] args) dans C:\Documents and Settings\christophe\Mes documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:ligne 42
       à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       à System.Threading.ThreadHelper.ThreadStart()
  InnerException: