Setup Subsonic on IIS 7 (Windows Home Server 2011) - ARR 2.5
Posted: Thu Aug 11, 2011 1:31 am
Update: 2016-04-25 - Subsonic 6.0beta1
My previous tutorial utilized Tomcat's Jakarta ISAPI Redirect library to use IIS as the front end for Tomcat serving Subsonic. This implementation has one glaring problem when trying to stream transcoded files. Basically, the isapi_redirect.dll waits for the transcoded file to be completed prior to then serving it to the client. This makes for noticeable gaps between songs as each new song gets transcoded. Without finding a fix, I stumbled across a different technology to link IIS and Tomcat: Microsft's Application Request Router Extension. I have copied much of my previous tutorial here as there are many of the same steps and, as before, I've posted 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
Setup a Subsonic website in IIS
Install and Configure the Application Request Router Extension in IIS
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
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.
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".
Install and Configure the Application Request Router Extension in IIS
First, we need to install the Extension. In order to do that you need to open up your web browser on the server and point to the following url: "http://www.iis.net/download/ApplicationRequestRouting". The only way to install this extension, that I know of, is through this microsoft portal. Click on Install and bypass any warnings that IE may give you due to the default security settings. On the next page click Install Now. On the next popup click Run. This will start the Web Platform 3.0 which will facilitate the intallation of the Extension. Click Install and then I Accept to accept the installation of the required dependencies. When the installation is complete Click Finish and exit the Web Platform 3.0.
If your IIS Manager was open during the installation you will need to close the manager completely and then reopen it in order to see the new extension.
Now, lets setup the Routing so that our subsonic website utilizes the Tomcat as an application server. Click on the Server in the IIS Manager (denoted by the servers computer name) . Now double click on Application Request Routing Cache. Click Server Proxy Settings from the context menu on the right. Click the Enable checkbox and leave all other values as their defaults. Click the Apply item in the list on the right to save the settings.
Finally, all we have to do is setup a rule for our website to redirect to Tomcat. Select the Subsonic website in the pane on the left and then double-click URL Rewrite. Click the Add item on the list in the left column. Select an Inbound Blank Rule and click OK. Name our Rule something meaningful such as "Tomcat". Change the Using drop-down box to Wildcards and put a single asterisk ("*") in the Pattern text field. Change the Rewrite URL field to "http://localhost:8080/{R:0}" and click apply to save the rule.
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 not yet found any issues. However, I would like to rewrite the ARR rules such that removing the default Tomcat application ROOT is not necessary. I am sure this can be accomplished through the creation of more specific Inbound and Outbound rules, but have not yet had the time to delve into it.
Updates for Subsonic 6.0beta1 (And probably earlier) - Added 2016-04-25
I have recently pushed my Subsonic version up to the 6.0beta1 and have had to update a few of the packages for this release. I am quite sure that these were required somewhere else along the line before now as I was still using Subsonic 4.7. I can confirm that I had the same problems in 5.3 as I did when trying to push to 6.0beta1 that were resolved after updating the following:
Java Runtime Environment 8u92 (x64) - http://www.oracle.com/technetwork/java/ ... 33155.html
Tomcat 8.0.33 (x64) - http://tomcat.apache.org/download-80.cgi#8.0.33
Subsonic 6.0beta1 (.war) - https://sourceforge.net/projects/subson ... p/download
My previous tutorial utilized Tomcat's Jakarta ISAPI Redirect library to use IIS as the front end for Tomcat serving Subsonic. This implementation has one glaring problem when trying to stream transcoded files. Basically, the isapi_redirect.dll waits for the transcoded file to be completed prior to then serving it to the client. This makes for noticeable gaps between songs as each new song gets transcoded. Without finding a fix, I stumbled across a different technology to link IIS and Tomcat: Microsft's Application Request Router Extension. I have copied much of my previous tutorial here as there are many of the same steps and, as before, I've posted 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
Setup a Subsonic website in IIS
Install and Configure the Application Request Router Extension in IIS
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
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.
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".
Install and Configure the Application Request Router Extension in IIS
First, we need to install the Extension. In order to do that you need to open up your web browser on the server and point to the following url: "http://www.iis.net/download/ApplicationRequestRouting". The only way to install this extension, that I know of, is through this microsoft portal. Click on Install and bypass any warnings that IE may give you due to the default security settings. On the next page click Install Now. On the next popup click Run. This will start the Web Platform 3.0 which will facilitate the intallation of the Extension. Click Install and then I Accept to accept the installation of the required dependencies. When the installation is complete Click Finish and exit the Web Platform 3.0.
If your IIS Manager was open during the installation you will need to close the manager completely and then reopen it in order to see the new extension.
Now, lets setup the Routing so that our subsonic website utilizes the Tomcat as an application server. Click on the Server in the IIS Manager (denoted by the servers computer name) . Now double click on Application Request Routing Cache. Click Server Proxy Settings from the context menu on the right. Click the Enable checkbox and leave all other values as their defaults. Click the Apply item in the list on the right to save the settings.
Finally, all we have to do is setup a rule for our website to redirect to Tomcat. Select the Subsonic website in the pane on the left and then double-click URL Rewrite. Click the Add item on the list in the left column. Select an Inbound Blank Rule and click OK. Name our Rule something meaningful such as "Tomcat". Change the Using drop-down box to Wildcards and put a single asterisk ("*") in the Pattern text field. Change the Rewrite URL field to "http://localhost:8080/{R:0}" and click apply to save the rule.
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 not yet found any issues. However, I would like to rewrite the ARR rules such that removing the default Tomcat application ROOT is not necessary. I am sure this can be accomplished through the creation of more specific Inbound and Outbound rules, but have not yet had the time to delve into it.
Updates for Subsonic 6.0beta1 (And probably earlier) - Added 2016-04-25
I have recently pushed my Subsonic version up to the 6.0beta1 and have had to update a few of the packages for this release. I am quite sure that these were required somewhere else along the line before now as I was still using Subsonic 4.7. I can confirm that I had the same problems in 5.3 as I did when trying to push to 6.0beta1 that were resolved after updating the following:
Java Runtime Environment 8u92 (x64) - http://www.oracle.com/technetwork/java/ ... 33155.html
Tomcat 8.0.33 (x64) - http://tomcat.apache.org/download-80.cgi#8.0.33
Subsonic 6.0beta1 (.war) - https://sourceforge.net/projects/subson ... p/download