Click here to Skip to main content
15,884,298 members
Articles / Hosted Services / Azure

Deploy Unity3D Game in Windows Azure

Rate me:
Please Sign up or sign in to vote.
3.00/5 (3 votes)
7 Jun 2015CPOL3 min read 12.5K   5   1
Embed a game developed with Unity game engine to your website which is hosted on Azure.

Introduction

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. Internet programs such as Web servers and browsers all have a list of MIME types, so that they can transfer files of the same type in the same way, no matter what operating system they are working in. There are many predefined MIME types, such as GIF graphics files and PostScript files. It is also possible to define your own MIME types.

In addition to e-mail applications, Web browsers also support various MIME types. This enables the browser to display or output files that are not in HTML format.

 

If you try serving .mp4 files from your webserver it will also throw a 404.3 error because it blocks requests for unknown mime types as Azure does not want to serve out random content. We really don’t want our web server to serve any random files like.mdb (access database), .passwd (password), .inc (source include) or other files that may have landed in our web content directory. So we error on the safe side and block all unknown extensions by default from being served.  To make it easy to troubleshoot, we return this special error - coded 404.3. 

 

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.

 

Image 1

 

Lets Start

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 https://filezilla-project.org/ . 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.

 

Image 2

 

  1. In FileZilla go to “File -> Site Manager

Image 3

 

  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.

 

  1. In the site folder under the root directory edit the “web.config” file or create it.
  2. Make some  changes as follows

 

XML
<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

 

Image 4

 

If you're editing htaccess files on your server, you need to add this:

XML
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.

 

Image 5

 

Similarly if you want to serve .mp4 files you can add the following in the “web.config” file

XML
<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/

 

Image 6

 

Points of Interest

Embeding a game which is developed by you in your site is pretty much interesting. You can show your game to the world. It is very easy to add MIME types to Azure. By adding MIME types we can serve anyother file types also.

History

V1 of article

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
India India
Pooja Baraskar is an accomplished software engineer, inventor, and technical author with over a decade of experience in the tech industry. With a passion for innovation and a commitment to excellence, Pooja has established herself as a thought leader and an agent of change in the industry. Currently, Pooja is leading various developer programs globally at Intel, leveraging her expertise and vision to drive impactful initiatives that shape the industry and empower tech professionals around the world.
As a tech trailblazer, Pooja is passionate about challenging the status quo and driving innovation. She is a pioneer in areas such as artificial intelligence and the Internet of Things and has a proven ability to translate complex technical concepts into accessible and actionable ideas. She has an impressive track record of delivering results in complex, high-stakes projects and is continually seeking new ways to drive value and make a difference.
Pooja is also an accomplished technical author. Her writing is known for its clarity, accessibility, and technical accuracy, making her a trusted source of information for developers and tech enthusiasts around the world. Digital courseware For Educators for OpenVINO developer by her has been used to teach AI in several universities across the globe, helping to equip the next generation of tech professionals with innovative skills. Pooja is an active member of the tech community, sharing her expertise through speaking engagements, workshops, and mentorship. Her contributions to the field have been widely recognized, including being named a Top Software Innovator by Intel and a Most Valuable Professional by Microsoft.
In addition to her work in the tech industry, Pooja is an avid traveler, passionate cook, and skilled martial artist. Her diverse interests and experiences have given her a well-rounded perspective on life and work, allowing her to approach challenges with creativity, energy, and enthusiasm.

Comments and Discussions

 
GeneralAzure Pin
Member 130087038-Mar-17 18:43
Member 130087038-Mar-17 18:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.