Dominic Cronin's weblog
Getting IIS Express to run in a 64 bit process, and other fun Tridion content delivery configurations
In the last couple of days, I've spent far more time than I'd like figuring out how to get a Tridion-based web application to run correctly under Visual Studio. There are three basic choices:
- Run it directly using Visual Studio
- Run it using IIS Express
- Run it using IIS (non-Express version)
As the application is intended to run on a 64 bit architecture, there are some challenges. Visual Studio runs in 32 bit mode, so the first option is out. Using full-on IIS is an attractive thought; you can manually configure the application pool to run in 64 bit mode. Unfortunately, getting a debug session up and running takes more configuration than that. You have to set up the web site correctly, and it was just too fiddly. I ran out of time, or steam or whatever. (Somebody will probably tell me it's easy, and I dare say it is when you know how, and aren't spending time you really should be spending on something else. Any hints are always welcome.)
Of course, with a Tridion site, half the game is making sure you have the correct DLLs in place for the processor architecture you are using. Along the way, I discovered that the quick and dirty way to tell if you have a 32 or 64 bit version of xmogrt.dll (Juggernet's "native" layer) is the size. The 64 bit version comes in at 1600KB and the 32 bit version is about half that at 800KB or so. This varies from version to version, so on a 2013 system, it's 1200ish/900ish KB, but once you get the hang of it, you can tell them apart at sight, which is pretty useful. The other DLLs are also important, although as far as I can tell, only Tridion.ContentDelivery.AmbientData.dll is hard-compiled for 64 bit architecture, at least on the 2011 system I was working on. The rest of the .NET assemblies are compiled to MSIL, which of course, will run on either architecture.
But I digress. The thing I wanted to blog (and this will definitely be tagged note-to-self) was how to get IIS Express to run in 64 bit mode. By default it runs on 32 bits, but if you follow this link:
... you will find the following nugget of goodness:
You can configure Visual Studio 2012 to use IIS Express 64-bit by setting the following registry key:
reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\WebProjects /v Use64BitIISExpress /t REG_DWORD /d 1
However, this feature is not supported and has not been fully tested by Microsoft. Improved support for IIS Express 64-bit is under consideration for the next release of Visual Studio.
Very handy indeed. Running under IIS express is just one click of the button. Just works.
And by way of a PS. (Post Script that is, not PowerShell) here's how you find the processor architecture of a DLL (This time on my 2013 image.)
PS C:\inetpub\www.visitorsweb.local\bin> [reflection.assemblyname]::GetAssemblyName((resolve-path '.\Tridion.ContentDelivery.AmbientData.dll')).ProcessorArchitecture MSIL
Well anyway - it's no fun scratching your head over stuff like this. Maybe this helps.
Pulling website information out of the IIS metabase
Pulling website information out of the IIS metabase
Someone recently asked me how to find the URL where the Tridion user interface is running. The idea was to automate the set-up for Tridion Site-Edit. The following snippet of code doesn't solve their problem, but for me it was a bit of fun exploring how to pull up this data out of the IIS metabase using C#. Although this blog entry is categorised as "Tridion", this code isn't particularly Tridion-specific. It's sufficient to show that it's not particularly painful to work with IIS programatically. You can also write to the metabase using similar techniques.
using System; using System.Collections.Generic; using System.Text; using System.DirectoryServices; namespace Hinttech.Dotnet.Samples.WebSiteDumper { class Program { static void Main( string[] args ) { using (DirectoryEntry webServers = new DirectoryEntry("IIS://localhost/W3SVC")) { foreach( DirectoryEntry server in webServers.Children) { PropertyValueCollection serverComment = server.Properties["ServerComment"]; if ( serverComment.Value != null && serverComment[0].ToString() == "Tridion Content Manager") { Console.WriteLine("The Tridion web site is running on: "); Console.WriteLine("==================================="); // If you want the https sites too, you need to do the same thing for "SecureBindings" foreach ( string serverBinding in server.Properties["ServerBindings"] ) { string[] serverBindingParts = serverBinding.Split(':'); string ipAddress = serverBindingParts[0]; string port = serverBindingParts[1]; string hostHeader = serverBindingParts[2]; if (string.IsNullOrEmpty(ipAddress)) { ipAddress="Default"; } Console.WriteLine( "\tIP Address = {0}\n\tPort= {1}\n\tHostHeader= {2}", ipAddress, port, hostHeader ); Console.WriteLine("==================================="); } server.Dispose(); break; } server.Dispose(); } } #if DEBUG Console.ReadKey(); #endif } } }