#font-face not working on windows server? - wordpress

I developed a wordpress theme for a client on my test server which is running linux. the #font-face loaded the .otf and rendered the text correctly in this instance. It worked on multiple computers.
But now when I install this theme on a client's wordpress, running on windows server 2003, it doesn't load the font on any computer.
Any ideas?

IIS in not sending the .otf with a proper MIME type set, that is why it is not working. You need to configure IIS MIME types to respond to .otf files as "font/opentype".

Sometimes, windows server will allow this:
Put this in web.config
<system.webServer>
...
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
Thumb this up!

Had the same issue on Windows 2003, updated the MIME type as suggested by Maxim V. Pavlov, recycled the App Pool in IIS and all works fine...

Related

My website hosted in the local iis can't load images, js and other files

I am totally new to IIS and this is my first attempt to host one of my websites on my own machine's IIS server.
I installed IIS using Add windows features on or off feature and used aspnet_regiis -i to install asp on it.
Then I copied my website's content to wwwroot directory and I have a partially working website, because some fonts, images, js files and a webm file can't be loaded into the page and when I go to these files by url I get this error message:
HTTP Error 404.3 - Not Found The page you are requesting cannot be
served because of the extension configuration. If the page is a
script, add a handler. If the file should be downloaded, add a MIME
map.
I should mention that I checked static content under common http features in Add windows features on or off but still I have the same problem
Thanks in advance for your help
UPDATE:
I used to have a host and domain and this website worked perfectly there, So it Not a website problem
UPDATE2
some pictures load ok and some don't.some fonts are ok and some don't.chrome's developer console states an 404 error message for missing files and scripts and when I go to them via url,I get the error message above(which indeed is a 404 error message)
UPDATE3
I added woff and webm formats to MIME types so now these types of files work.But still some javascript files won't work since they are using json I json format and json is not added yet to the list of MIME types
What can I do so that ALL TYPES OF FILES are allowed?
Modify your web.config like
<system.webServer>
<staticContent>
...
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
...
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>

IIS returns 404 not found for .mp4 files

I used hmtl video tag to play video . In my localhost video plays but when I published . It is not played.I have created project based on in ASP.NET.
I locally use like this method.
http://localhost:41563/files/Just.mp4
and When I published the url give me an error like this:
http://111.111.22.22:41563/files/Just.mp4
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
How can I solve this.
Check if you have IIS MIME Type for mp4 added for hosted site (or for the directory where you have your video files).
For the Win Server 2012 is is already there but for Win Server 2008 it is not included by default.
So, if you developed/tested on WinSer2012 and then deployed on WinSer2008 then you can have this issue.
The mp4 MIME settings are:
File name extension: .mp4
MIME type: video/mp4
The MIME type can be added via Web.config as well, just in case your IIS is on Azure:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>
</system.webServer>
</configuration>
https://blogs.iis.net/bills/how-to-add-mime-types-with-iis7-web-config

Possible to add MIME type to web.config without possibly breaking the site?

I had a web.config in one of the websites on my IIS that was adding a support for .7z file extension. When I later added a global .7z support at the server level, this site was broken - IIS Manager is complaining that it "cannot add duplicate collection entry of type 'mimeMap'..." and all web requests to i.g. CSS files ended with an HTTP 500 error.
I was using this in the site's web.config:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".7z" mimeType="application/x-7z-compressed" />
</staticContent>
</system.webServer>
Is there maybe some other syntax that would add 7z to the list only if it wasn't defined yet?
According to this, you should remove the global setting in the special config before adding it in a different form.
Explcitly:
<system.webServer>
<staticContent>
<remove fileExtension=".7z" />
<mimeMap fileExtension=".7z" mimeType="application/x-7z-compressed" />
</staticContent>
</system.webServer>
Of course this doesn't really help you now as you might just as well drop the local setting completely (as it's likely to coincide with the global setting). But if you had known this back when you added local 7zip support, you wouldn't have encountered the error now ...

svg is not working on IIS webserver on localhost

I'm trying to set a ".svg" image as background-image using css, but it is not working. The url is valid and returns 200 status code and works on ".png" images.
What is the problem?
Your IIS is most likely not configured with SVG as a content type, try adding
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
inside the <system.webServer> scope of your web.config.
This will of course only work if your application is the one serving up the svg. If the svg is not contained inside your application but in a separate directory of the web server, you'll need to add the same mapping to your web server instead inside the "mime-types" tab.
Try This - Your App/Website under Default Settings of IIS Manager
Then "Add" -> { .svg : image/svg+xml }
from web.config
<system.webServer>
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
</system.webServer>
or in IIS
go to MIME Types and add file name extension:.svg
MIME Type: image/svg+xml
In my case, I included all of the mime-types I wanted in the applicationHost.config file (which is usually located at C:\Windows\System32\inetsrv\config) under the <system.webServer> scope, like Joachim Isaksson mentioned. This allows all of my IIS sites to inherit the same mime-types, and gives you one location to change them if something goes wrong.
Just in case, if anyone want to use IIS Manager for the same, select 'top node' on 'Connections' tree (typically the name of the machine you're on), and on right side, locate 'MIME Types' in 'IIS' section - double click the same. You should see list of all file types with 'Entry Type' as 'Local'. Add '.svg' type as mentioned by posts above (which amends same file as mentioned by 'Markaius'). This enables to 'inherit' same MIME type for any application on the machine.

Add MIME mapping in web.config for IIS Express

I need to add a new MIME mapping for .woff file extensions to IIS Express.
If I add the following snippet to the "applicationhost.config" of IIS Express it works fine:
<staticContent lockAttributes="isDocFooterFileName">
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
...
But I would actually like to do add it to my "web.config" so that not every developer would need to change their "applicationhost.config" locally.
So I removed it again from the "applicationhost.config" file and added the following snippet to the project's "web.config":
<system.webServer>
...
<staticContent>
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
</staticContent>
</system.webServer>
Unfortunately it doesn't seem to work that way because when I try to access a .woff file I end up with a HTTP 404.3 error.
What am I doing wrong?
Putting it in the "web.config" works fine. The problem was that I got the MIME type wrong. Instead of font/x-woff or font/x-font-woff it must be application/font-woff:
<system.webServer>
...
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
See also this answer regarding the MIME type: https://stackoverflow.com/a/5142316/135441
Update 4/10/2013
Spec is now a recommendation and the MIME type is officially: application/font-woff
If anybody encounters this with errors like
Error: cannot add duplicate collection entry of type ‘mimeMap’ with unique key attribute
and/or other scripts stop working when doing this fix, it might help to remove it first like this:
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
At least that solved my problem
<system.webServer>
<staticContent>
<remove fileExtension=".woff"/>
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
</staticContent>
</system.webServer>
I know this is an old question, but...
I was just noticing my instance of IISExpress wasn't serving woff files, so I wen't searching (Found this) and then found:
http://www.tomasmcguinness.com/2011/07/06/adding-support-for-svg-to-iis-express/
I suppose my install has support for SVG since I haven't had issue with that. But the instructions are trivially modifiable for woff:
Open a console application with administrator privilages.
Navigation to the IIS Express directory. This lives under Program Files or Program Files (x86)
Run the command:
appcmd set config /section:staticContent /+[fileExtension='woff',mimeType='application/x-woff']
Solved my problem, and I didn't have to mess with some crummy config (like I had to to add support for the PUT and DELETE verbs). Yay!
Thanks for this post. I got this worked for using mustache templates in my asp.net mvc project
I used the following, and it worked for me.
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mustache" mimeType="text/html"/>
</staticContent>
</system.WebServer>
I'm not using IIS Express but developing against my Local Full IIS 7.
So if anyone else get's here trying to do that, I had to add the mime type for woff
via IIS Manager
Mime Types >> Click Add link on right and then enter
Extension: .woff
MIME type: application/font-woff
To solve the problem, double-click the "MIME Types" configuration option while having IIS root node selected in the left panel and click "Add..." link in the Actions panel on the right. This will bring up the following dialog. Add .woff file extension and specify "application/x-font-woff" as the corresponding MIME type:
Follow same for woff2 with application/x-font-woff2
I was having a problem getting my ASP.NET 5.0/MVC 6 app to serve static binary file types or browse virtual directories. It looks like this is now done in Configure() at startup. See http://docs.asp.net/en/latest/fundamentals/static-files.html for a quick primer.

Resources