How to scope mimetypes to one IIS site?
right now they are set globally - i don’t see the need for that.
Example
MimeTypes = @(
@{
FileExtension = '.woff2'
MimeType = 'font/x-woff2'
Ensure = 'Present'
}
ZaMotH
April 13, 2023, 6:42am
2
Hello Efff
You are just throwing an array of a single item, which is a hash table.
What is the command you are trying to use this for ?
It is hard to help you, without understanding what you are trying to accomplish
Right now the mimetypes are applied globally using the above. Not sure if its possible using DSC to apply it to one site.
My sites are created via
`@{
ShortName = 'site1'
DNSSuffix = 'abc.com'
SiteAuthors = ('ExampleUser')
State = "Started"
Certificate = "HJE#&$HDHJJE1dftdfasfd"
RuntimeVersion = '' # 'v2.0' or 'v4.0'
Enable32Bit = '' # 'Enabled' or 'Disabled'
HSTS = 'Present'
HSTSAge = '31536000' #52 Weeks
IISAnonymousAuth = '' # 'Enabled' or 'Disabled'
IISAnonymousUser = '' # '' for AppPool Identity or 'IUSR' for IUSR account
IISWindowsAuth = '' # 'Enabled' or 'Disabled'
Nodes = ('') #Empty List
Applications = @()
VirtualDirectories = @()
} #example
)`
ZaMotH
April 14, 2023, 12:21pm
4
Not willing to be hard, but we are coders, not experts on MIME types. You need to provide sufficient context to explain what you are doing. For example, you are showing a hash table here. Where does it come from ? How did you built it ? How do you intend to use it ?
I guess you will probably use this using an IIS powershell command. Which one ? Do you have an error code ?
Without more information, we won’t be able to help you.
An existing DSC script first sets the global mimetypes. i would like to set mimetypes per site if possible.?
MimeTypes = @(
@{
FileExtension = '.woff2'
MimeType = 'font/x-woff2'
Ensure = 'Present'
}
Each site is created and inherits the Mimetype from above code.
>
> ```
> @{
> ShortName = 'site1'
> DNSSuffix = 'abc.com'
> SiteAuthors = ('ExampleUser')
> State = "Started"
> Certificate = "HJE#&$HDHJJE1dftdfasfd"
> RuntimeVersion = '' # 'v2.0' or 'v4.0'
> Enable32Bit = '' # 'Enabled' or 'Disabled'
> HSTS = 'Present'
> HSTSAge = '31536000' #52 Weeks
> IISAnonymousAuth = '' # 'Enabled' or 'Disabled'
> IISAnonymousUser = '' # '' for AppPool Identity or 'IUSR' for IUSR account
> IISWindowsAuth = '' # 'Enabled' or 'Disabled'
> Nodes = ('') #Empty List
> Applications = @()
> VirtualDirectories = @()
> } #example
> ```
When i try to set the mimetype per site. i just ignores it. NO errors.
@{
ShortName = 'site1'
DNSSuffix = 'abc.com'
SiteAuthors = ('ExampleUser')
State = "Started"
Certificate = "HJE#&$HDHJJE1dftdfasfd"
RuntimeVersion = '' # 'v2.0' or 'v4.0'
Enable32Bit = '' # 'Enabled' or 'Disabled'
HSTS = 'Present'
HSTSAge = '31536000' #52 Weeks
IISAnonymousAuth = '' # 'Enabled' or 'Disabled'
IISAnonymousUser = '' # '' for AppPool Identity or 'IUSR' for IUSR account
IISWindowsAuth = '' # 'Enabled' or 'Disabled'
Nodes = ('') #Empty List
MineMap = @(
@{
FileExtension = '.boo'
MimeType = 'Application/vboo'
Ensure = 'Present'
} #visio
)
Applications = @()
VirtualDirectories = @()
} #example