views:

42

answers:

0

Hello,

I'm getting the following error

IIS://networth-web6/W3SVC/AppPools/netbasistest
errorSystem.Runtime.InteropServices.COMException
(0x80020006): Unknown name. (Exception
from HRESULT: 0x80020006
(DISP_E_UNKNOWNNAME))
at System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args)
at ASP.nb_test_aspx._Render_control1(HtmlTextWriter __w, Control parameterContainer)

Any ideas? I know my username and password work just fine to rdp into the server. when use with this code.

<%@ Page Language="vb" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Management" %>
<%@ Import Namespace="System.DirectoryServices" %>
<%
  Response.Write("<HTML><HEAD></HEAD><BODY>")
    Dim AppPoolFullPath As String = "IIS://networth-web6/W3SVC/AppPools/netbasistest"
    Dim Username as String = "networth-web6\username"
    Dim Password as String = "password"
    Try
       Dim w3svc As New DirectoryEntry(AppPoolFullPath,Username,Password)
      w3svc.Username = Username
      w3svc.Password = Password
      w3svc.Invoke("Recycle", Nothing)
      Response.Write(AppPoolFullPath & "<br />")
    Catch exc as exception
      Response.Write(AppPoolFullPath & " error"&exc.tostring()&"<br />")
    End Try

  Response.Write("<p />-- done --")
  Response.Write("</BODY></HTML>")
%>