Setup Subsonic on IIS 7 (Windows Home Server 2011) - JK 1.2

Tutorials, tips and tricks.

Moderator: moderators

Setup Subsonic on IIS 7 (Windows Home Server 2011) - JK 1.2

Postby csobsidian » Wed Aug 10, 2011 6:34 am

I have just successfully navigated the murky waters of getting IIS 7 on my new Windows Home Server 2011 box to work properly with subsonic. I say murky because the information that was required to get my box working properly had to be gleaned from many different sources. I apologize if this has been done before but I could not find it so I've post this here with the hope that it may serve as a central place with all the necessary information for someone to get Windows Home Server 2011 working with Subsonic with the following requirements:
- Make subsonic available on port 80.
- Make subsonic available at the root directory (no trailing folder structure in order to access subsonic).
- Leave the default IIS Web Sites intact.

In order to effectively help you all follow my lead we need to make some assumptions about the way my network is setup. For the purposes of this tutorial lets assume my network is setup with the following (replace the specifics as appropriate for your own network setup):
- I have a router with an external IP address of 50.51.52.53
- I have a router setup to use the dynamic dns of myWHS.dyndns.org which points to the above external address.
- My internal LAN uses the subnet 192.168.1.*
- My server's LAN address is 192.168.1.100.
- My server has a DNS service responsible for the domain home.com which is used to differentiate services on my LAN (subsonic.home.com, ftp.home.com, etc.).
- I have a client computer on my LAN that will have music/video streamed to it.

I will go into the detail of each step, but here's a quick overview of the entire process:

Download Programs
Install Java
Install Tomcat
Install Subsonic
Setup Subsonic for Transcoding
Install the isapi_redirect.dll
Setup a Subsonic website in IIS
Configure IIS to use the isapi redirection


Download the Required Programs

The first step is to get all the binaries that are required to make a complete setup. The following is the complete list of what I downloaded and which versions I used in my installation. All versions are 64 bit since Windows Home Server 2011 only comes in the 64bit flavor. Some of these are pre-compiled for ease of use. Source code is available for those who want to use non-static libraries or just for fun.

Java Runtime Environment 6.26 (x64) - http://javadl.sun.com/webapps/download/ ... leId=49026
Tomcat 6.0.32 (x64) - http://mirrors.kahuki.com/apache/tomcat ... 6.0.32.exe
isapi_redirect.dll (x64) - http://www.apache.org/dist/tomcat/tomca ... 64-iis.zip
Subsonic 4.4 (.war) - http://sourceforge.net/projects/subsoni ... p/download
LAME 3.98.4 (x64) - http://www.rarewares.org/dancer/dancer.php?f=322
FFMpeg 2011-08-06 (x64 static) - http://ffmpeg.zeranoe.com/builds/win64/ ... -static.7z


Install Java

To get the ball rolling start with the Java installation since its required for Tomcat. I used the defaults for the entire installation which put the java files at "C:\Program Files\Java\jre6".


Install Tomcat

Next, perform the installation of Tomcat. I chose version 6 because I read elsewhere that there some issues with using version 7, though I don't recall what those conflicts are nor do I know if the most recent versions of 7 have rectified the issues. Just like the Java installation I used all the default settings. After the installation is complete verify that the tomcat server is running by opening a browser on the server and pointing it to http://localhost:8080. You can then test that the server is accessible remotely by pointing the browser on the client computer to http://192.168.1.100:8080. The important one here is that subsonic comes up locally. If you want tomcat to be accessible remotely then you can open port 8080 (or whatever port you used for Tomcat) for inbound access in Windows Firewall as I did, but for IIS to communicate with Tomcat this isn't necessary.


Install Subsonic

Open the subsonic zip archive and extract the subsonic.war file to "C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps". Restart Tomcat via the system tray on the server and then test the subsonic install by pointing your browser to "http://localhost:8080/subsonic/". As before you can test that this is available from a remote browser by pointing to "http://192.168.1.100:8080/subsonic/".

In order to make Subsonic the default application later in IIS, you will need to make it the default application in Tomcat. To do this, stop the Tomcat server. In the Tomcat webapps folder rename the "ROOT" application to "ROOT original". You could just delete it if you wanted to, but renaming it allows you to keep it archived for later should that be of value to you. Now rename the "subsonic" directory (which was created by Tomcat when it decompressed the subsonic.war file) as "ROOT" and rename the "subsonic.war" file as "ROOT.war". Restart the Tomcat server and you should now be able to see the Subsonic server at "http://localhost:8080" and "http://192.168.1.100:8080".


Setup Subsonic for Transcoding

Subsonic comes configured for transcoding by default. All that needs to be added is to give it the libraries to do the transcoding with. In order to do that we simply extract the LAME and FFMpeg zip archives to the "c:\subsonic\transcode" directory. Subsonic should automatically find them the next time you attempt to stream a file that isn't an mp3 or an flv.


Install the isapi_redirect.dll

In order to get tomcat to communicate with IIS you will need to install the isapi redirection dll. First, create a new directory called "isapi" in the Tomcat installation folder. The path should look like "C:\Program Files\Apache Software Foundation\Tomcat 6.0\isapi". Unzip the isapi_redirect.dll from the downloaded zip archive and place it in this new folder.

Now create a new file in the isapi directory called "isapi_redirect.properties". This file containts the parameters that the dll will use to interact with IIS. Open up the file in a text editor such as notepad and copy the following contents:

extension_uri=/jakarta/isapi_redirect.dll
log_file=C:\Program Files\Apache Software Foundation\Tomcat 6.0\logs\isapi_redirect.log
log_level=info
worker_file=C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\workers.properties
worker_mount_file=C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\uriworkermap.properties


Next create a new file in Tomcat's conf directory called "workers.properties". This file contains the parameters for the worker threads that will be created by the dll. Open this file in a text editor such as notepad and copy the following contents:

worker.list=local
worker.local.type=ajp13
worker.local.host=localhost
worker.local.port=8009


Last, create a new file in Tomcat's conf directory called "uriworkermap.properties". This file maps specific folders to specific workers. In this setup everything from the root directory on will be utilized by the local worker created in the workers.properties file. Open this file in a text editor such as notepad and copy the following contents:

/*=local


Setup the Subsonic Website in IIS

Now we need a place to access the subsonic application in IIS. First, create an empty subsonic folder in the inet pub directory "C:\inetpub". In the Internet Information Services Manager, expand the tree and click on the Sites entry. Click Add Web Site. Call the new site Subsonic and enter a path of the empty subsonic folder that we just created ("C:\inetpub\subsonic"). For the binding I chose my IPv4 address of 192.168.1.100 and, per our requirements, left the default port of 80. Because this particular web site must respond when it gets a request for myWHS.dyndns.org this is what must be entered for the Fully Qualified Domain Name field. Click OK to create the new website.

Any number of virtual hosts can be used to point to this website. Per our requirements above we also want to be able to use subsonic.home.com on the LAN in order to access subsonic. To do this right click on the Subsonic website in the IIS manager and select Edit Bindings. A new window will appear where you will see the original binding made when you created the website. Click the Add button and you will get a form that looks identical to the bindings setting you used earlier. Select the same IP address (192.168.1.100) but this time add an FQDN of "subsonic.home.com".


Configure IIS to Use the ISAPI Plugin

First we need to tell IIS that it is allowed to use the dll. Click on the Server in the IIS Manager (denoted by the servers computer name) . Now double click on ISAPIS and CGI restrictions. Click Add from the context menu on the right. The new restriction should be pointed to the isapi_redirect.dll which should be at "C:\Program Files\Apache Software Foundation\Tomcat 6.0\isapi\isapi_redirect.dll". Give this restriction a meaningful name. I chose "Tomcat ISAPI Redirect". Make sure to select the "allow extension path to execute" checkbox and click OK.

Next we need to add the filter to the subsonic website. Click the Subsonic website in the tree on the left and then double click the ISAPI Filters item. In the context menu on the right click the Add item. Give it a meaningful name. Again, here I chose "Tomcat ISAPI Redirect". Now point it to the dll at "C:\Program Files\Apache Software Foundation\Tomcat 6.0\isapi\isapi_redirect.dll" and click OK.

Now we need to create a new virtual directory that will tell the IIS Subsonic website that it should use the isapi_redirect.dll. Right click on the Subsonic website in the IIS Manager and select Add Virtual Directory. The alias should be "jakarta" as this was defined in our isapi_redirect.properties file we created earlier. The path should be the location of the dll at "C:\Program Files\Apache Software Foundation\Tomcat 6.0\isapi". Click OK to create the virtual directory.

Lastly, we must allow the dll to have execute permissions within our website. Select the Subsonic website from the tree on the left and then double-click on Handler Mappings. Select the disabled ISAPI-dll entry at the top of the list and click on Edit Feature Permissions from the context menu on the right. Make sure it has all permissions, including execute, and click OK. The item should move from the disabled section to the enabled section.

Restart the IIS server and you should be able to see subsonic through the IIS server at the two addresses we defined as virtual hosts http://subsonic.home.com (internally) and http://myWHS.dyndns.org (internally and externally assuming the router is configured properly).


Known Issues

I have identified one issue with the isapi_redirect.dll waiting for a file that requires transcoding to be completed before it passes it on to the final client. Files that don't require transcoding (mp3s and flvs) seem to have no issue. Other than converting your library to mp3 format or utilizing tomcat directory (via port 8080) I have not yet found an answer for this problem.


Edit: My original post accidentally omitted a step required to configure the isapi_redirect.dll in IIS and the steps to get transcoding working. I have added both of these and corrected a few minor spelling and grammatical errors.
Edit: I have changed the title to reflect that we are using the Jakarta ISAPI Redirect Library (v1.2). I am working on a second tutorial that will instead use the Microsoft Application Request Routing (v2.5) Extension. I'm hoping that this might fix the transcoding issue when utilizing the isapi_redirect.dll.
Last edited by csobsidian on Thu Aug 11, 2011 1:32 am, edited 4 times in total.
csobsidian
 
Posts: 22
Joined: Mon Aug 08, 2011 2:07 am

How to Setup Subsonic on IIS 7 (Windows Home Server 2011)

Postby msalinas90 » Wed Aug 10, 2011 8:28 pm

THANK YOU THANK YOU THANK YOU!!! :D
msalinas90
 
Posts: 3
Joined: Wed Aug 10, 2011 8:25 pm

Postby csobsidian » Wed Aug 10, 2011 11:07 pm

You're welcome!
csobsidian
 
Posts: 22
Joined: Mon Aug 08, 2011 2:07 am


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 15 guests