Unity embedded in ASP.Net (ASPX)

Hey all,

First off, really sorry about the length of this, but I felt it needed some explaining...

I ran into some peculiar behavior yesterday when I was deploying my unity web app. I'm actually a .Net-programmer, so I thought I'd embed the unity content into an ASPX-site so that I'd be in a familiar environment when the time came to develop the website surrounding the Unity application. I got the IT department to create a brand new, clean Windows Server 2008 R2 with the usual roles - ASP.Net, .Net 4.0, etc.

I then proceeded to create a sample ASP.Net site, uploaded it, it worked. I then embedded the .unity3d-file into the ASPX-file using the HTML code provided in the HTML file Unity automatically creates when you build a web app. And there's where the problem started.

It works locally, but not on the server. When I load the site with the unity content from the server, the progress bar never loads, and in Firefox, all I see is the logo. In IE, I got an "Invalid data file" error. At this point, I know what you're thinking - But it's not a missing MIME-type in IIS7. I googled that for ages yesterday, and already followed those instructions: I've tried to add ".unity3d" and "application/vnd.unity" first as staticContent in my Web.config and second on the IIS itself, and then when that didn't work, in the opposite order. When I was just about running out of ideas, I tried uploading the HTML file Unity creates instead of the ASPX-site I'd ported the code to and that worked, both locally and on the server.

The funny thing is, after I'd had the server serve the Unity content through the HTML-file once, the ASPX-site started working on its own. That, I really REALLY don't understand.

Anyone got an idea what happened in the meantime? What did the HTML file do to the server that caused it to suddenly start serving .unity3d-files through ASPX, when it wouldn't before in spite of the MIME-type being present?

Worked first time using “application/octet-stream” instead of vnd.unity


     <mimeMap fileExtension=".unity3d" mimeType="application/octet-stream" />