Override mime type with VS Web Dev Server
I would like to serve xbaps from VS web dev server (cassini) to Firefox, but when serving from dev server Firefox suggests to download this file. As far as I can tell, this is because the dev server is serving an xbap file with mime type "application / octet-stream" instead of "application / x-ms-xbap" which works when sent from IIS.
Does anyone know how to change the mime type that the dev server uses for * .xbap files?
a source to share
You can not. WevDev.WebHost is quite clumsy when releasing content types and has a very limited range of specific content types.
You can use CassiniDev . The latest version provides extended content support including .xbap.
see http://cassinidev.codeplex.com/SourceControl/changeset/view/49870#894160 for a complete list of supported types.
Refresh . Probably the problem is that you installed FF after 3.5sp1 and don't have NPWPF.dll
FF plugins in your directory. Do you have this file?
Update 2 I just released a version of CassiniDev which is a great replacement for the Visual Studio Development server. These enhancements include improved content type support and integrated traffic logging / viewing.
a source to share
It might be too late, but for others who are getting this problem, here's how to fix it:
I solved it for mp4 videos, but it's the same principle for any mime, just reconsider your needs.
I assume you are using vs2012, create an IHttpHandler and copy this code into it:
public class Mp4Handler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "video/mp4";
context.Response.BinaryWrite(File.ReadAllBytes(context.request.PhysicalPath));
context.Response.End();
}
public bool IsReusable{ get{ return false;}}
}
And don't forget to add the system.web file to your web.config file:
<httpHandlers>
<add verb="*" path="*.mp4" type="[your-namespace].Mp4Handler" />
</httpHandlers>
Thus, you no longer need CassiniDev for mp4 to work correctly, CassiniDev is not evil and noteworthy - without it, I could not verify that the problem was in the first place.
a source to share
Note that with VS 2010 SP1, you can now use IIS Express instead of Cassini for your web projects, giving you complete control over your MIME types.
More information: http://blogs.msdn.com/b/webdevtools/archive/2011/03/14/enabling-iis-express-support-in-vs-2010-sp1.aspx
a source to share