MIME(Multipurpose Internet Mail Extensions)多用途互联网邮件扩展类型。是设定某种扩展名的文件用一种应用程序来打开的方式类型,当该扩展名文件被访问的时候,浏览器会自动使用指定应用程序来打开。多用于指定一些客户端自定义的文件名,以及一些媒体文件打开方式。

 很多站长在发布完网站后会发现某些字体类型的文件,比如*.woff*.woff2,或者一些jsonp格式的文件无法打开,但是在服务器上是真实存在的,这种情况就是没有为服务器添加正确的MIME类型。

如何添加MIME类型

在IIS里添加

打开IIS管理器,找到MIME类型选项。

IIS管理器添加MIME类型

找到MIME类型模块,添加指定的MIME类型。

IIS管理器添加MIME类型

点击添加,打开添加MIME类型对话框,填入文件扩展名,比如.woff,填入正确的MIME类型,比如application/font-woff

在web.config里添加

打开网站根目录的web.config文件, 添加以下代码:

<staticcontent>
    <mimeMap fileExtension=".woff" mimeType="application/font-woff2" />
</staticcontent>

其中fileExtension为文件扩展名,需要填入.woff之类的扩展名,mp3格式就是.mp3mimeType就是MIME类型了,需要一字不差的填入。

所有MIME类型

MIME类型有很多种,为了方便站长添加和修改,我们在下面的表格里列出了几乎所有的MIME类型供站长们参考。(按Ctrl+F可以查找扩展名)

文件扩展名 MIME类型 文件扩展名 MIME类型
323 text/h323 p7b application/x-pkcs7-certificates
3gp video/3gpp p7c application/x-pkcs7-mime
aab application/x-authoware-bin p7m application/x-pkcs7-mime
aam application/x-authoware-map p7r application/x-pkcs7-certreqresp
aas application/x-authoware-seg p7s application/x-pkcs7-signature
acx application/internet-property-stream pac audio/x-pac
ai application/postscript pae audio/x-epac
aif audio/x-aiff pan application/x-pan
aifc audio/x-aiff pbm image/x-portable-bitmap
aiff audio/x-aiff pcx image/x-pcx
als audio/X-Alpha5 pda image/x-pda
amc application/x-mpeg pdb chemical/x-pdb
ani application/octet-stream pdf application/pdf
apk application/vnd.android.package-archive pfr application/font-tdpfr
asc text/plain pfx application/x-pkcs12
asd application/astound pgm image/x-portable-graymap
asf video/x-ms-asf pict image/x-pict
asn application/astound pko application/ynd.ms-pkipko
asp application/x-asap pm application/x-perl
asr video/x-ms-asf pma application/x-perfmon
asx video/x-ms-asf pmc application/x-perfmon
au audio/basic pmd application/x-pmd
avb application/octet-stream pml application/x-perfmon
avi video/x-msvideo pmr application/x-perfmon
awb audio/amr-wb pmw application/x-perfmon
axs application/olescript png image/png
bas text/plain pnm image/x-portable-anymap
bcpio application/x-bcpio pnz image/png
bin application/octet-stream pot, application/vnd.ms-powerpoint
bld application/bld ppm image/x-portable-pixmap
bld2 application/bld2 pps application/vnd.ms-powerpoint
bmp image/bmp ppt application/vnd.ms-powerpoint
bpk application/octet-stream pptx application/vnd.openxmlformats-officedocument.presentationml.presentation
bz2 application/x-bzip2 pqf application/x-cprplayer
c text/plain pqi application/cprplayer
cal image/x-cals prc application/x-prc
cat application/vnd.ms-pkiseccat prf application/pics-rules
ccn application/x-cnc prop text/plain
cco application/x-cocoa proxy application/x-ns-proxy-autoconfig
cdf application/x-cdf ps application/postscript
cer application/x-x509-ca-cert ptlk application/listenup
cgi magnus-internal/cgi pub application/x-mspublisher
chat application/x-chat pvx video/x-pv-pvx
class application/octet-stream qcp audio/vnd.qcelp
clp application/x-msclip qt video/quicktime
cmx image/x-cmx qti image/x-quicktime
co application/x-cult3d-object qtif image/x-quicktime
cod image/cis-cod r3t text/vnd.rn-realtext3d
conf text/plain ra audio/x-pn-realaudio
cpio application/x-cpio ram audio/x-pn-realaudio
cpp text/plain rar application/octet-stream
cpt application/mac-compactpro ras image/x-cmu-raster
crd application/x-mscardfile rc text/plain
crl application/pkix-crl rdf application/rdf+xml
crt application/x-x509-ca-cert rf image/vnd.rn-realflash
csh application/x-csh rgb image/x-rgb
csm chemical/x-csml rlf application/x-richlink
csml chemical/x-csml rm audio/x-pn-realaudio
css text/css rmf audio/x-rmf
cur application/octet-stream rmi audio/mid
dcm x-lml/x-evm rmm audio/x-pn-realaudio
dcr application/x-director rmvb audio/x-pn-realaudio
dcx image/x-dcx rnx application/vnd.rn-realplayer
der application/x-x509-ca-cert roff application/x-troff
dhtml text/html rp image/vnd.rn-realpix
dir application/x-director rpm audio/x-pn-realaudio-plugin
dll application/x-msdownload rt text/vnd.rn-realtext
dmg application/octet-stream rte x-lml/x-gps
dms application/octet-stream rtf application/rtf
doc application/msword rtg application/metastream
docx application/vnd.openxmlformats-officedocument.wordprocessingml.document rtx text/richtext
dot application/msword rv video/vnd.rn-realvideo
dvi application/x-dvi rwc application/x-rogerwilco
dwf drawing/x-dwf s3m audio/x-mod
dwg application/x-autocad s3z audio/x-mod
dxf application/x-autocad sca application/x-supercard
dxr application/x-director scd application/x-msschedule
ebk application/x-expandedbook sct text/scriptlet
emb chemical/x-embl-dl-nucleotide sdf application/e-score
embl chemical/x-embl-dl-nucleotide sea application/x-stuffit
eps application/postscript setpay application/set-payment-initiation
epub application/epub+zip setreg application/set-registration-initiation
eri image/x-eri sgm text/x-sgml
es audio/echospeech sgml text/x-sgml
esl audio/echospeech sh application/x-sh
etc application/x-earthtime shar application/x-shar
etx text/x-setext shtml magnus-internal/parsed-html
evm x-lml/x-evm shw application/presentations
evy application/envoy si6 image/si6
exe application/octet-stream si7 image/vnd.stiwap.sis
fh4 image/x-freehand si9 image/vnd.lgtwap.sis
fh5 image/x-freehand sis application/vnd.symbian.install
fhc image/x-freehand sit application/x-stuffit
fif application/fractals skd application/x-Koan
flr x-world/x-vrml skm application/x-Koan
flv flv-application/octet-stream skp application/x-Koan
fm application/x-maker skt application/x-Koan
fpx image/x-fpx slc application/x-salsa
fvi video/isivideo smd audio/x-smd
gau chemical/x-gaussian-input smi application/smil
gca application/x-gca-compressed smil application/smil
gdb x-lml/x-gdb smp application/studiom
gif image/gif smz audio/x-smd
gps application/x-gps snd audio/basic
gtar application/x-gtar spc application/x-pkcs7-certificates
gz application/x-gzip spl application/futuresplash
h text/plain spr application/x-sprite
hdf application/x-hdf sprite application/x-sprite
hdm text/x-hdml sdp application/sdp
hdml text/x-hdml spt application/x-spt
hlp application/winhlp src application/x-wais-source
hqx application/mac-binhex40 sst application/vnd.ms-pkicertstore
hta application/hta stk application/hyperstudio
htc text/x-component stl application/vnd.ms-pkistl
htm text/html stm text/html
html text/html svg image/svg+xml
hts text/html sv4cpio application/x-sv4cpio
htt text/webviewhtml sv4crc application/x-sv4crc
ice x-conference/x-cooltalk svf image/vnd
ico image/x-icon svg image/svg+xml
ief image/ief svh image/svh
ifm image/gif svr x-world/x-svr
ifs image/ifs swf application/x-shockwave-flash
iii application/x-iphone swfl application/x-shockwave-flash
imy audio/melody t application/x-troff
ins application/x-internet-signup tad application/octet-stream
ips application/x-ipscript talk text/x-speech
ipx application/x-ipix tar application/x-tar
isp application/x-internet-signup taz application/x-tar
it audio/x-mod tbp application/x-timbuktu
itz audio/x-mod tbt application/x-timbuktu
ivr i-world/i-vrml tcl application/x-tcl
j2k image/j2k tex application/x-tex
jad text/vnd.sun.j2me.app-descriptor texi application/x-texinfo
jam application/x-jam texinfo application/x-texinfo
jar application/java-archive tgz application/x-compressed
java text/plain thm application/vnd.eri.thm
jfif image/pipeg tif image/tiff
jnlp application/x-java-jnlp-file tiff image/tiff
jpe image/jpeg tki application/x-tkined
jpeg image/jpeg tkined application/x-tkined
jpg image/jpeg toc application/toc
jpz image/jpeg toy image/toy
js application/x-javascript tr application/x-troff
jwc application/jwc trk x-lml/x-gps
kjx application/x-kjx trm application/x-msterminal
lak x-lml/x-lak tsi audio/tsplayer
latex application/x-latex tsp application/dsptype
lcc application/fastman tsv text/tab-separated-values
lcl application/x-digitalloca ttf application/octet-stream
lcr application/x-digitalloca ttz application/t-time
lgh application/lgh txt text/plain
lha application/octet-stream uls text/iuls
lml x-lml/x-lml ult audio/x-mod
lmlpack x-lml/x-lmlpack ustar application/x-ustar
log text/plain uu application/x-uuencode
lsf video/x-la-asf uue application/x-uuencode
lsx video/x-la-asf vcd application/x-cdlink
lzh application/octet-stream vcf text/x-vcard
m13 application/x-msmediaview vdo video/vdo
m14 application/x-msmediaview vib audio/vib
m15 audio/x-mod viv video/vivo
m3u audio/x-mpegurl vivo video/vivo
m3url audio/x-mpegurl vmd application/vocaltec-media-desc
m4a audio/mp4a-latm vmf application/vocaltec-media-file
m4b audio/mp4a-latm vmi application/x-dreamcast-vms-info
m4p audio/mp4a-latm vms application/x-dreamcast-vms
m4u video/vnd.mpegurl vox audio/voxware
m4v video/x-m4v vqe audio/x-twinvq-plugin
ma1 audio/ma1 vqf audio/x-twinvq
ma2 audio/ma2 vql audio/x-twinvq
ma3 audio/ma3 vre x-world/x-vream
ma5 audio/ma5 vrml x-world/x-vrml
man application/x-troff-man vrt x-world/x-vrt
map magnus-internal/imagemap vrw x-world/x-vream
mbd application/mbedlet vts workbook/formulaone
mct application/x-mascot wav audio/x-wav
mdb application/x-msaccess wax audio/x-ms-wax
mdz audio/x-mod wbmp image/vnd.wap.wbmp
me application/x-troff-me wcm application/vnd.ms-works
mel text/x-vmel wdb application/vnd.ms-works
mht message/rfc822 web application/vnd.xara
mhtml message/rfc822 wi image/wavelet
mi application/x-mif wis application/x-InstallShield
mid audio/mid wks application/vnd.ms-works
midi audio/midi wm video/x-ms-wm
mif application/x-mif wma audio/x-ms-wma
mil image/x-cals wmd application/x-ms-wmd
mio audio/x-mio wmf application/x-msmetafile
mmf application/x-skt-lbs wml text/vnd.wap.wml
mng video/x-mng wmlc application/vnd.wap.wmlc
mny application/x-msmoney wmls text/vnd.wap.wmlscript
moc application/x-mocha wmlsc application/vnd.wap.wmlscriptc
mocha application/x-mocha wmlscript text/vnd.wap.wmlscript
mod audio/x-mod wmv audio/x-ms-wmv
mof application/x-yumekara wmx video/x-ms-wmx
mol chemical/x-mdl-molfile wmz application/x-ms-wmz
mop chemical/x-mopac-input wpng image/x-up-wpng
mov video/quicktime wps application/vnd.ms-works
movie video/x-sgi-movie wpt x-lml/x-gps
mp2 video/mpeg wri application/x-mswrite
mp3 audio/mpeg wrl x-world/x-vrml
mp4 video/mp4 wrz x-world/x-vrml
mpa video/mpeg ws text/vnd.wap.wmlscript
mpc application/vnd.mpohun.certificate wsc application/vnd.wap.wmlscriptc
mpe video/mpeg wv video/wavelet
mpeg video/mpeg wvx video/x-ms-wvx
mpg video/mpeg wxl application/x-wxl
mpg4 video/mp4 x-gzip application/x-gzip
mpga audio/mpeg xaf x-world/x-vrml
mpn application/vnd.mophun.application xar application/vnd.xara
mpp application/vnd.ms-project xbm image/x-xbitmap
mps application/x-mapserver xdm application/x-xdma
mpv2 video/mpeg xdma application/x-xdma
mrl text/x-mrml xdw application/vnd.fujixerox.docuworks
mrm application/x-mrm xht application/xhtml+xml
ms application/x-troff-ms xhtm application/xhtml+xml
msg application/vnd.ms-outlook xhtml application/xhtml+xml
mts application/metastream xla application/vnd.ms-excel
mtx application/metastream xlc application/vnd.ms-excel
mtz application/metastream xll application/x-excel
mvb application/x-msmediaview xlm application/vnd.ms-excel
mzv application/metastream xls application/vnd.ms-excel
nar application/zip xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
nbmp image/nbmp xlt application/vnd.ms-excel
nc application/x-netcdf xlw application/vnd.ms-excel
ndb x-lml/x-ndb xm audio/x-mod
ndwn application/ndwn xmz audio/x-mod
nif application/x-nif xof x-world/x-vrml
nmz application/x-scream xpi application/x-xpinstall
nokia-op-logo image/vnd.nok-oplogo-color xpm image/x-xpixmap
npx application/x-netfpx xsit text/xml
nsnd audio/nsnd xsl text/xml
nva application/x-neva1 xul text/xul
nws message/rfc822 xwd image/x-xwindowdump
oda application/oda xyz chemical/x-pdb
ogg audio/ogg yz1 application/x-yz1
oom application/x-AtlasMate-Plugin z application/x-compress
p10 application/pkcs10 zac application/x-zaurus-zac
p12 application/x-pkcs12 zip application/zip
json application/json