Share via


Deploy Unity3D Game in Windows Azure

 
Instead of playing games I enjoy developing them. I develop 3D games with Unity and Unreal game engines. I always want to embed a demo version of some of my games in my blog which is hosted on Azure. I uploaded the files from final build of the game to Azure but it didn’t help me. I got a 404.3 error. Most servers require no configuration at all. We have to just upload the .unity3d file, and the accompanying html file but it doesn’t work on Azure. On Azure we have to add a custom mime type.

MIME types

 

MIME stands for Multi-purpose Internet Mail Extensions. MIME types form a standard way of classifying file types on the Internet. Azure blocks unknown MIME types and return 404.3 error.

 Server Error in Application "<application name>"
 --------------------------------------------------------------------------------
HTTP Error 404.3 - Not Found
HRESULT: 0x80070032
Description of HRESULT: The page you are requesting cannot be served because of the Multipurpose Internet Mail Extensions (MIME) map policy that is configured on the Web server. The page you requested has a file name extension that is not recognized, and is not allowed.  

http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/06/1.png  

It is very easy to add MIME types to Azure. So let us see how to do that.

  1. Get access to your site’s home directory. I configured FTP access to my site with FileZilla, Definitely you can use any other FTP client application also. You can get FileZilla from here . Download and install it in your Computer.
  2. Log in to your Azure portal
  3. Go to your website’s dashboard
  4. Download the publish profile.

  http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/06/21.png  
5. In FileZilla go to “File -> Site Manager”

 http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/06/31.png 

  1. Finally connect to your website with username and password as shown in your publish profile and you will see three folders:
                site - This is the folder where your website specific files are located
                Logfiles - This is the folder where your website specific Diagnostics LOG files are located.
                Data - Site data is stored here.
  2. In the site folder under the root directory edit the “web.config” file or create it.
     8. Make some changes as follows 

 ***    <configuration>*** ***
           <system.webServer>***
                <staticContent>
 ***                     <mimeMap fileExtension=".unity3d" mimeType="application/vnd.unity" />
***                </staticContent> ***
            </system.webServer>***
 ***   </configuration>***  

The MIME type for Unity webplayer content is:
               application/vnd.unity 
 And the file extension for unity webplayer files is:
               .unity3d    

http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/06/41.png 

If you're editing htaccess files on your server, you need to add this:
             ***AddType application/vnd.unity unity3d  ***

  1. You are now done. Restart your website from the dashboard. Now you can show your developed game to the world.

  http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/06/6.png 
   
Similarly if you want to serve .mp4 files you can add the following in the “web.config” file   ***
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />***
 <mimeMap fileExtension=".m4v" mimeType="video/m4v" /> 

 You can check my embed Unity games here http://poojabaraskar.com/campfire-earthborns/    

http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/06/7.png