mcintyre321 / EmbeddedResourceVirtualPathProvider

A custom VirtualPathProvider for IIS - load views and assets from Embedded Resources in referenced assemblies
http://www.adverseconditionals.com/2011/07/portable-aspnet-code-using.html
MIT License
63 stars 42 forks source link

404 with .svg and .woff #4

Closed martingit closed 10 years ago

martingit commented 10 years ago

I get a 404.0 in IIS 7.5 when trying to load a svg/woff file with EmbeddedResourceVirtualPathProvider. I've added the mimetype in web.config < system.webServer> < staticConfent > < remove fileExtension=".svg" /> < mimeMap fileExtension=".svg" mimeType="image/svg+xml" /> < remove fileExtension=".svgz" /> < mimeMap fileExtension=".svgz" mimeType="image/svg+xml" /> < remove fileExtension=".woff" /> < mimeMap fileExtension=".woff" mimeType="application/font-woff" /> </ staticContent> </ system.webServer> Png, js, cshtml all work fine.

mcintyre321 commented 10 years ago

Does it work if you copy it into the host project?

sent from my mobile On 19 Dec 2013 09:05, "martingit" notifications@github.com wrote:

I get a 404.0 in IIS 7.5 when trying to load a svg/woff file with EmbeddedResourceVirtualPathProvider. I've added the mimetype in web.config

Png, js, cshtml all work fine.

— Reply to this email directly or view it on GitHubhttps://github.com/mcintyre321/EmbeddedResourceVirtualPathProvider/issues/4 .

martingit commented 10 years ago

Yes, the host project can serve .svg and .woff, but not as embedded resource. I've also added < modules runAllManagedModulesForAllRequests="true"/>, but that didnt work either.

martingit commented 10 years ago

Debug info EmbeddedResourceVirtualPathProvider (svg file): One call to FileExists in Vpp.cs returns true, but GetFile is never called.

png file: Two calls to FileExists (both return true) and one call to GetFile. The file is delivered correctly.

Is this IIS 7.5 config error?

martingit commented 10 years ago

Found the issue. It was in System.WebServer.Handlers in my web.config. I had forgotten to add handlers for the named filetypes. My bad.

mcintyre321 commented 10 years ago

They are a PITA

thcat2 commented 10 years ago

I have problem with the latest ERVPP witth IIS 7.5 (MVC 5-VS 2013). Static file Handlers were added : < system.webServer> < handlers>
< add verb="GET,HEAD,POST" path="*.css" name="Static for css" type="System.Web.StaticFileHandler" /> < /handlers>

< staticContent> < remove fileExtension=".css" /> < mimeMap fileExtension=".css" mimeType="text/css" /> < /staticContent>

< /system.webServer>

While it works perfectly in IIS Express, IIS 7.5 deployment does not work with 404 error !

You have any idea ?

mcintyre321 commented 10 years ago

Have you tried without < mimeMap fileExtension=".css" mimeType="text/css" /> ?

thcat2 commented 10 years ago

Yes, I just tried it out and get the same error. I really wonder how MartinGit can make it work.

mcintyre321 commented 10 years ago

Put a repo up somewhere with a minimal repro and I will take a look.

martingit commented 10 years ago

I only added these to system.webserver.handlers.config < handlers> < add verb="GET" path=".js" name="Static for js" type="System.Web.StaticFileHandler" /> < add verb="GET" path=".css" name="Static for css" type="System.Web.StaticFileHandler" /> < add verb="GET" path=".png" name="Static for png" type="System.Web.StaticFileHandler" /> < add verb="GET" path=".jpg" name="Static for jpg" type="System.Web.StaticFileHandler" /> < add verb="GET" path=".svg" name="Static for svg" type="System.Web.StaticFileHandler" /> < add verb="GET" path=".svgz" name="Static for svgz" type="System.Web.StaticFileHandler" /> < add verb="GET" path=".eot" name="Static for eot" type="System.Web.StaticFileHandler" /> < add verb="GET" path=".woff" name="Static for woff" type="System.Web.StaticFileHandler" /> < add verb="GET" path="*.ttf" name="Static for ttf" type="System.Web.StaticFileHandler" /> </ handlers>

thcat2 commented 10 years ago

Well, I tried to create a blank MVC project with ERVPP, it works. Must be some problem with my project setting that affect ERVPP code