IIS: How to get the metabase path?

I am trying to get a list of mime types known to the IIS server ( which you can see and answered me 2 years ago ). Nested answer:

GetObject("IIS://LocalHost/MimeMap") msdn

GetObject("IIS://LocalHost/MimeMap") KB246068

GetObject("IIS://LocalHost/MimeMap") Scott Hanselman Blog

new DirectoryEntry("IIS://Localhost/MimeMap")) Stack overflow

new DirectoryEntry("IIS://Localhost/MimeMap")) Stack overflow

New DirectoryServices.DirectoryEntry("IIS://localhost/MimeMap") Velocity Reviews


You get the idea. Everyone agrees that you are using the iis: // localhost / mimemap magic path . And it works great, except when it doesn't.

The only key that I can find why it fails, the report MVP the IIS, the Crowe by Chris, :

string ServerName = "LocalHost";
string MetabasePath = "IIS://" + ServerName + "/MimeMap";
    // Note: This could also be something like
    // string MetabasePath = "IIS://" + ServerName + "/w3svc/1/root";

DirectoryEntry MimeMap = new DirectoryEntry(MetabasePath);

There are two keys here:

  • He refers to iis://localhost/mimemap the path of the metabase . Which sounds to me as if it is a kind of "path" to the "metabase".
  • , - ; , .

" MetabasePath"

iis://localhost/MimeMap

? MetabasePath?


. , , MetabasePath, . iis://localhost/SoTiredOfThis

+5
2

IIS , IIS , :

IIS://Localhost/mimemap

IIS: OLE.

​​IIS6 (C:\Windows\System32\inetsrv\metabase.xml), "blob" XML. .

Location.

IIS://localhost Location /LM, .

IIS://Localhost/mimemap Location /LM/MimeMap.

, IIS://localhost/[path] IIS://[RemoteMachineName]/[path]. , .

IIS://Localhost/mimemap Mime. ( IIS ).

Mime , :

IIS://localhost/W3SVC/[iisnumber]/ROOT/MimeMap

​​IIS , , .

Update:

, DirectoryEntry, , DirectoryEntry - , ADSI, IIS, LDAP WinNT. DirectoryEntry, . ADSI .

DirectoryEntry, Exists, . :

// Does Default Website exist?
if(DirectoryEntry.Exists("IIS://localhost/w3svc/1"))
{
  // Do work...
}
+5

0x80005000 . , IIS7 ​​IIS6.

0

All Articles