- Пуск-> запустить inetmgr (запустить консоль управления IIS)
- Нажмите на типы MIME
- Нажмите Добавить ..
.xap
применение / х-приложение Silverlight-
- Нажмите ОК
или вы можете сохранить этот код в текстовом файле и выполнить его на сервере:
AddMimeType.vbs
Dim VPath
'This changes setting at machine level, you may change it to a different path
VPath = "IIS://localhost/MimeMap"
'Add/Update the type for DLR language extension
UpdateMime ".xap", "application/x-silverlight-app"
'Search for the given extension and update its type
'when not found, add it into the collection
Sub UpdateMime(Extension, NewType)
Dim LocalMimeMap, MimeMap, MMItem, aMimeMapNew()
Dim i
i = 0
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Set LocalMimeMap = GetObject(VPath)
MimeMap = LocalMimeMap.GetEx("MimeMap")
Dim found
found = False
For Each MMItem In MimeMap
ReDim Preserve aMimeMapNew(i)
Set aMimeMapNew(i) = CreateObject("MimeMap")
aMimeMapNew(i).Extension = MMItem.Extension
If MMItem.Extension = Extension Then
found = True
MsgBox("Update type of extension " + MMItem.Extension + " from " + MMItem.MimeType + " to " + NewType)
aMimeMapNew(i).MimeType = NewType
Else
aMimeMapNew(i).MimeType = MMItem.MimeType
End If
i = i + 1
Next
If found Then
LocalMimeMap.PutEx ADS_PROPERTY_UPDATE, "MimeMap", aMimeMapNew
LocalMimeMap.SetInfo
Else
MsgBox("Add new extension " + Extension + " with type " + NewType)
AddMime Extension, NewType
End If
End Sub
Sub AddMime(ExtensionToAdd, MimeTypeToAdd)
Dim LocalMimeMap, MimeMap
Dim i
Const ADS_PROPERTY_UPDATE = 2
Set LocalMimeMap = GetObject(VPath)
MimeMap = LocalMimeMap.GetEx("MimeMap")
i = UBound(MimeMap)+1
Redim Preserve MimeMap(i)
Set MimeMap(i) = CreateObject("MimeMap")
MimeMap(i).Extension = ExtensionToAdd
MimeMap(i).MimeType = MimeTypeToAdd
LocalMimeMap.PutEx ADS_PROPERTY_UPDATE,"MimeMap",MimeMap
LocalMimeMap.SetInfo
End Sub