0x80005008L E_ADS_BAD_PARAMETER One or more input parameters are
invalid.
invalid.
解决方案 »
- 求解释
- 关于去读DropDownList取值,并且用Lable 自动生成的问题!
- 判断一个字符串里的数字是排过序,如果排过,是降序还是升序
- 给未激活窗体发送消息的问题
- 初学者,菜鸟问题~!高手请进!
- ASP.net 编译时权限出错,access is denied
- C# dataGridView 控件单元格 点击复制
- 用WebClient.UploadFile向指定的URL去POST文件,在另一端怎么接收啊
- WinForm中使用Timer控件的问题?
- 怎样使一个程序只能有一个实例被创建,即只有一个窗口,发言送分
- 求救 !!!Visual Studio .NET 已检测到指定的Web服务器运行的不是 ASP.NET 1.1 散分了!!!
- 急需一个udp 客户/服务器互相通信的例子!!
DirectoryEntry rootfolder = new DirectoryEntry("IIS://localhost/W3SVC/1/ROOT");
DirectoryEntry de = rootfolder.Children.Find("docula","IIsVirtualDir");
你的Find()函数的第二个参数应该是"IIsWebVirtualDir",而不是"IIsVirtualDir"或者你用 deRoot.SchemaClassName 肯定也不会错
{
DirectoryEntry folderRoot = new DirectoryEntry("IIS://localhost/W3SVC/1/Root");
try
{
DirectoryEntry deVirDir = folderRoot.Children.Find(nameDirectory,VirDirSchemaName); folderRoot.Children.Remove(deVirDir); folderRoot.CommitChanges();
}
catch
{
return false;
}
return true;
}
你参考一下:
Function CreateVirtualFolder(strMachineName,strParentPath ,strVirtualFolder, strAppName, strPath)
' On Error Resume Next Dim IIsObject
Dim IIsObjectPath
Dim IIsObjectRelativePath
Dim NewObject
Dim ObjectTypeName
Dim ParentObjPath
Dim ParentObjSize
Dim FullAdsParentPath
Dim MachineName
Dim OpenErr ' Set the return code - assume success
CreateVirtualFolder = true
ObjectTypeName="IIsWebVirtualDir" if len(trim(strMachineName))=0 or len(trim(strVirtualFolder))=0 or len(trim(strParentPath))=0 then
CreateVirtualFolder = false
Exit Function
end if IIsObjectPath = strParentPath + "/" +strVirtualFolder MachineName = strMachineName ' Parse the path and determine if the parent exists.
ParentObjSize = InStrRev(IIsObjectPath, "/")
ParentObjPath = "" If ParentObjSize <> 0 Then
ParentObjPath = Left(IIsObjectPath, ParentObjSize - 1)
IIsObjectRelativePath = Right(IIsObjectPath, Len(IIsObjectPath) - ParentObjSize)
Else
IIsObjectRelativePath = IIsObjectPath
End If If ParentObjPath <> "" Then
FullAdsParentPath = "IIS://" & MachineName & "/" & ParentObjPath
Else
FullAdsParentPath = "IIS://" & MachineName
End If
' First, attempt to open the parent path and add the new path.
Set IIsObject = GetObject(FullAdsParentPath)
If Err.Number <> 0 Then
OpenErr = Err.Number
OpenErrDesc = Err.Description
Err.Clear
' Attempt to get the Computer Object (IIS://LocalHost)
Set IIsObject = GetObject("IIS://" & MachineName)
If Err.Number <> 0 Then
' WScript.Echo
' ReportError ()
' WScript.Echo "Error accessing the object: " & IIsObjectPath
' WScript.Quit (Err.Number)
CreateVirtualFolder = false
Exit Function
End If
End If
IIsObject.AccessWrite = True
IIsObject.SetInfo If (OpenErr <> 0) Then
WScript.Echo IIsObjectPath
On Error Resume Next
Set NewObject = IIsObject.Delete(ObjectTypeName, IIsObjectPath)
On Error GoTo 0
Set NewObject = IIsObject.Create(ObjectTypeName, IIsObjectPath)
Else
'WScript.Echo "IIsObjectRelativePath" + IIsObjectRelativePath
On Error Resume Next
Set NewObject = IIsObject.Delete(ObjectTypeName, IIsObjectRelativePath)
On Error GoTo 0
Set NewObject = IIsObject.Create(ObjectTypeName, IIsObjectRelativePath)
End If If Err.Number <> 0 Then
CreateVirtualFolder = false
Exit Function
End If NewObject.Put "Path", strPath
NewObject.Put "AccessRead", True
NewObject.Put "AccessScript", True NewObject.AppCreate2 1
NewObject.Put "AppFriendlyName",strAppName NewObject.Setinfo If Err.Number <> 0 Then
CreateVirtualFolder = false
Exit Function
End If
If OpenErr <> 0 Then
CreateVirtualFolder = false
Exit Function
End If If UCase(ObjectTypeName) = "IISOBJECT" Then
CreateVirtualFolder = false
Exit Function
End IfEnd function