MIME Types for ClickOnce deployment

When you are hosting a ClickOnce deployment on a webserver, you need have certain MIME types defined so the server knows how to handle the files. You can host a ClickOnce deployment on any server regardless of the operating system. So you can host a ClickOnce deployment on an Apache server just as easily as a server running Microsoft Windows Server. You just need to set up the right MIME types.

When you install the .NET Framework, it registers the MIME types automatically. This is why you don’t have to set up MIME types if you install IIS on your desktop machine and test your deployments by deploying to localhost. Carrying that forward, if you have the .NET Framework installed on your server, the MIME types should already be registered.

This is generally one of the first things to check when you’re having problems downloading the deployment. A definite sign that your MIME types are not set up correctly is if your customers try to install the application and it shows the XML of the deployment manifest (the .application file) in Internet Explorer rather than installing the application.

Here are the basic MIME types you need for every ClickOnce deployment:

.application –> application/x-ms-application
.manifest –> application/x-ms-manifest
.deploy –> application/octet-stream

If you are targeting .NET 3.5 or .NET 4.0, you need these as well:

.msp –> application/octet-stream
.msu –> application/octet-stream

If you are deploying an Office application (VSTO add-in), you need this one:

.vsto –> application/x-ms-vsto

If you are deploying a WPF application, you need these:

.xaml –> application/xaml+xml
.xbap –> application/x-ms-xbap

Click one of these links to see how to set MIME types in IIS 6 or IIS 7.

If your application is hosted on an Apache webserver, you can set up your own MIME types by putting entries in the .htaccess file in the root folder of your deployment. The syntax for adding the MIME types is this:

AddType Mime-type file-extension

For example, for the first three MIME types above, you would add these lines to your .htaccess file:

AddType application/x-ms-application application
AddType application/x-ms-manifest manifest
AddType application/octet-stream deploy

You can create the .htaccess file simply by opening notepad or some other text editor and adding the lines above to it, and saving it with the file name of .htaccess. Then copy it to the root of your deployment folders, and those MIME types will work for that folder and all of its subfolders.

For more information than you ever wanted to know about .htaccess files, check out this article.

Tags:

12 Responses to “MIME Types for ClickOnce deployment”

  1. Windows Client Developer Roundup for 6/14/2010 - Pete Brown's 10rem.net Says:

    [...] Mime Types for ClickConce Deployment (RobinDotNet) [...]

  2. How to host a ClickOnce deployment in Azure Blob Storage « RobinDotNet's Blog Says:

    [...] If you have any problems, you can check the MIME types on the published files and make sure they are right. These can be changed for each file if needed. With ClickOnce deployments, you should definitely be using the option that appends .deploy to all of your assemblies, so you should not have any files with unknown extensions. If you want to double-check, the MIME types for a ClickOnce deployment are explained here. [...]

  3. sebastien Says:

    Hi,

    I am trying to install a web page (.aspx) on wich I “Response.Redirect” to a functional clickonce file “myProgram.application&token=123″ still in http. Notice that I’m using parameters and IIS 6.

    The response.redirect always gets me a 405 error:
    “HTTP Error 405 – The HTTP verb used to access this page is not allowed.
    Internet Information Services (IIS)”

    I think I tried everything that you have writen on your site (mapping of applucation extensions, mime types).

    When the error comes in in InternetExplorer, if I do a simple refresh on that same page, everything passes and the clickonce install starts out.

    Any hints?

    thanks

    • robindotnet Says:

      I don’t think you can do a redirect to a ClickOnce application. The installation link has to point to the actual location. Why do you need to do a redirect?

  4. Simon Says:

    Hallo,

    to which apache folder should I copy my xbap application ? (which whould be the .exe, .manifest und .xbap)

    Thanks in advance.

    • robindotnet Says:

      I’m not sure; I haven’t deployed an xbap with C/O yet. If you aren’t publishing directly to the apache server from Visual Studio, then publish to a local directory and then replicate that directory structure. In a traditional C/O app, the .application file, setup.exe, and publish.htm (if you’re creating it) go in the top folder. Then there’s a folder called Application Files that has a bunch of folders — one for each version — under it. I would think the xbap would go under the versioned Application Files folder.

  5. Microsoft ClickOnce su Apache Server | NERDAMMER Says:

    [...] maggiori informazioni: MIME Types for ClickOnce deployment This entry was posted in Nerdaccia and tagged apache, ClickOnce by Nicola Ferraro. Bookmark the [...]

  6. ClickOnce su Apache « Emanuele Filardo Says:

    [...] posso essere pubblicati su Apache, anche le applicazioni sviluppate con tecnologia ClickOnce, qui trovate come fare. Share this:FacebookStampaEmailLinkedInTwitterLike this:LikeBe the first to like [...]

  7. hasbina Says:

    hi Robin,

    I have a ClickOnce application which is published to a IIS virtual directory. I lauch this ClickOnce application by clicking on a hyperlink from a webpage in an asp.net website using

    Call MainProject. put setup.exe in solution explorer.This work successfully in my computer.but in other systems do not work. I set the publishing location folder a website,

    http://my computer ip address/application name.

    Then, what is the mistake i done?

    Thanks in advance.

    • robindotnet Says:

      The hyperlink in the website should point to the setup.exe of the ClickOnce application, which is the bootstrapper. This installs the prerequisites and then installs the ClickOnce application. The installation URL of the ClickOnce application must be the URL used to install it, so if the application deployment is on your computer, then the URL has to point to your computer.

  8. geo Says:

    According to numerous online sources, the proper MIME type for .msi/.msu files is: application/x-ole-storage. Is that wrong? Does it matter that much?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

Join 65 other followers

%d bloggers like this: