css - Custom font works locally but not on server? -
i have @font-face
defined in site's cascading style sheet. font loads fine when browse site locally (served iis express). however, when loading application remote server (iis 7.5) reference font causes internal server 500 error. why below style work locally, not on server?
@font-face { font-family: dejavu sans mono; src: url('../fonts/dejavusansmono.ttf'); } header h1 { font-family: 'dejavu sans mono'; font-size: 3em; padding: 0; margin: 0; }
if check discover dejavusansmono.ttf
file not being copied server. since it's not being copied font file not there iis 7.5 provide. works locally because iis express able find file in local directory.
file types visual studio not recognize have buildaction property set none default; font files 1 such unrecognized type. having buildaction of none means visual studio ignore file when building application. there several out of box options buildaction property:
- none - file not included in project output group , not compiled in build process. example text file contains documentation, such readme file.
- compile - file compiled build output. setting used code files.
- content - file not compiled, included in content output group. example, setting default value .htm or other kind of web file.
- embedded resource - file embedded in main project build output dll or executable. typically used resource files.
the appropriate buildaction property setting dejavusansmono.ttf
content. setting buildaction way file copied remote server. unfortunately, manual process have repeated each file unrecognized file type sets developer's tedious error prone process. thankfully, andre loker has great blog post on setting default build action non-default file-types in visual studio.
Comments
Post a Comment