如何为网站find相应的日志文件文件夹?

在inetpub \ logs \ LogFiles(W3SVC1,W3SVC2等)下有多个网站和多个文件夹。 我怎样才能find一个给定的网站使用的文件夹?

好的,我find了这个属性 – 它被称为“网站ID”,并驻留在网站的“高级属性”。

适用于IIS6的用户

打开IISpipe理器,点击顶级网站文件夹,在右侧窗格中查看网站列表,列出应用程序ID。

感谢山姆在服务器故障

我们也可以使用命令行来获取它:

C:\>%windir%\system32\inetsrv\appcmd list site 

输出如下所示:

 SITE "Default Web Site" (id:1,bindings:HTTP/*:80:,state:Started) SITE "Site1" (id:2,bindings:http/*:81:,state:Started) 

id字段对应于在日志文件中find的id。 inetpub \ logs \ LogFiles(W3SVC1,W3SVC2

你可以从IISpipe理器的网站属性find。 对于IIS 6,网站ID是一个随机生成的每个网站的创build数字,而不是具有网站ID为1的默认网站。

例如:

  • W3SVC1
  • W3SVC719499532
  • W3SVC383732556

知道哪些网站是一个问题,因为它需要你手动查看每个网站。 下面的VB脚本将允许您输出ID和名称。

将该脚本保存到具有.VBS文件扩展名的文件,然后使用此命令运行(对于IIS 6)。

cscript MyFile.VBS

 Function ProcessWebSite(ServiceType, SiteNumber) Set IISWebSite = getObject("IIS://localhost/" & ServiceType & "/" & SiteNumber) Set IISWebSiteRoot = getObject("IIS://localhost/" & ServiceType & "/" & SiteNumber & "/root") ProcessWebSite = IISWebSite.ServerComment Set IISWebSiteRoot = nothing Set IISWebSite = Nothing end function Function ShowSites(ServiceType, ClassName, Title) Wscript.echo "Web Sites Description" Wscript.echo "===============================================================" Set IISOBJ = getObject("IIS://localhost/" & ServiceType) for each Web in IISOBJ if (Web.Class = ClassName) then wscript.echo Ucase(ServiceType) & "/" & Web.Name & _ Space(17-(len(Ucase(ServiceType))+1+len(Web.Name))) & " " & _ ProcessWebSite(ServiceType, Web.name) end if next Set IISOBj=Nothing WScript.Echo "" End function Call ShowSites("w3svc", "IIsWebServer", "Web")