<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.iis.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:cs="http://blogs.iis.net/"><channel><title>Sunday Morning Musings on IIS : MachineKeys</title><link>http://blogs.iis.net/lprete/archive/tags/MachineKeys/default.aspx</link><description>Tags: MachineKeys</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>IIS6: Restoring Metabase Configuration to a New Server</title><link>http://blogs.iis.net/lprete/archive/2008/01/20/iis6-restoring-metabase-configuration-to-a-new-server.aspx</link><pubDate>Sun, 20 Jan 2008 17:15:59 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:2143050</guid><dc:creator>lprete</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/lprete/rsscomments.aspx?PostID=2143050</wfw:commentRss><comments>http://blogs.iis.net/lprete/archive/2008/01/20/iis6-restoring-metabase-configuration-to-a-new-server.aspx#comments</comments><description>&lt;p&gt;I get this call quite frequently. Three times this week.&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;The Scenario&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;There was some sort of catastrophe, a hard drive crashed, a power failure, something. After recovering the OS from this catastrophe IIS is not working - The &lt;strong&gt;IIS Admin&lt;/strong&gt; and/or the &lt;strong&gt;World Wide Web &lt;/strong&gt;Services simply will not start.&lt;/p&gt;  &lt;p&gt;This failure to start is accompanied by various errors in the System Event Log, the most common I have seen is:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;Event Type: Error        &lt;br /&gt;Event Source: &lt;/font&gt;&lt;a name="#h1"&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;Service Control Manager&lt;/font&gt;&lt;/a&gt;       &lt;br /&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;Event Category: None        &lt;br /&gt;Event ID: &lt;/font&gt;&lt;a name="#h2"&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;7024&lt;/font&gt;&lt;/a&gt;       &lt;br /&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;Description:        &lt;br /&gt;The IIS Admin Service service terminated with service-specific error 2148073478&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;&lt;strong&gt;Some Explanation&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;Two things come into play here, MachineKeys &amp;amp; any encrypted keys in Metabase.XML. If IIS shut down abruptly one or more encrypted keys may not have been written out correctly into the Metabase.&amp;#160; If you went as far as reinstalling Windows then the MachineKeys of the new installation will not be able to decrypt the encrypted keys in the old Metabase. In either case when IIS tries to start the IIS Admin Service and uses a MachineKey under &lt;strong&gt;&lt;em&gt;C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys&lt;/em&gt;&lt;/strong&gt; to decrypt the encrypted keys in the Metabase (usually passwords). &lt;/p&gt;  &lt;p&gt;If this directory path is changed or the MachineKey itself changes,&amp;#160; or if the encrypted data was not written out correctly in the Metabase during the previous shut down, IIS will fail to start and will generate an error similar to the one listed above.&lt;/p&gt;  &lt;p&gt;The specific MachineKey will look similar to the following:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;c2319c42033a5ca7f44e731bfd3fa2b5_e19f50ab-fae5-485a-8306-2d05ab2c91c0&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="tre" size="2"&gt;&lt;strong&gt;Note: &lt;/strong&gt;The first half of the MachineKey (up to the under-score &amp;quot;_&amp;quot;) refers to the service, in this case IIS, the remainder of the MachineKey is a hash specific to the installation.&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;&lt;strong&gt;Possible Solution&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;To recover Site configurations:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Rename old Metabase to &lt;a name="#h2"&gt;&lt;font color="#000000"&gt;SiteConfig&lt;/font&gt;&lt;/a&gt;.&lt;a name="#h3"&gt;&lt;font color="#000000"&gt;XML&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Delete all AdminACL keys and password keys from &lt;a name="#h4"&gt;&lt;font color="#000000"&gt;SiteConfig&lt;/font&gt;&lt;/a&gt;.&lt;a name="#h5"&gt;&lt;font color="#000000"&gt;XML&lt;/font&gt;&lt;/a&gt;.&lt;/li&gt;    &lt;li&gt;With a clean Metabase (reinstall IIS if necessary) verify that IIS Admin and W3SVC start &amp;amp; the Default (under construction) page is working.&lt;/li&gt;    &lt;li&gt;Open 'clean' Metabase.&lt;a name="#h6"&gt;&lt;font color="#000000"&gt;XML&lt;/font&gt;&lt;/a&gt; and copy the SessionKey value.&lt;/li&gt;    &lt;li&gt;Open &lt;a name="#h7"&gt;&lt;font color="#000000"&gt;SiteConfig&lt;/font&gt;&lt;/a&gt;.&lt;a name="#h8"&gt;&lt;font color="#000000"&gt;XML&lt;/font&gt;&lt;/a&gt; and Delete SessionKey value and paste in the value from 'clean' Metabase.&lt;a name="#h9"&gt;&lt;font color="#000000"&gt;XML&lt;/font&gt;&lt;/a&gt;.&lt;/li&gt;    &lt;li&gt;In IIS MMC use Create New Site (from file) wizard. Point the tool to &lt;a name="#h10"&gt;&lt;font color="#000000"&gt;SiteConfig&lt;/font&gt;&lt;/a&gt;.&lt;a name="#h11"&gt;&lt;font color="#000000"&gt;XML&lt;/font&gt;&lt;/a&gt;, click Read File, and select site to import. &lt;/li&gt;    &lt;li&gt;Repeat for all sites (Web, FTP, SMTP) and Application Pools.&lt;/li&gt; &lt;/ol&gt;  &lt;h3&gt;&lt;strong&gt; Other Notes&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;&lt;strong&gt;This entire situation becomes much simpler if you regularly create *password* encrypted backups of the Metabase. &lt;/strong&gt;&lt;/font&gt;&lt;font color="#000000"&gt;The following KB article discusses how to use &lt;em&gt;iisback.vbs &lt;/em&gt;to create backups (although it doesn't stress the importance of backing up with a password).&amp;#160; Password encrypted backups remove the dependency on the MachineKeys for decrypting the encrypted Metabase keys making the backup much more portable.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;How To Create a Metabase Backup by Using IIS 6.0 in Windows Server 2003      &lt;br /&gt;&lt;/strong&gt;&lt;a href="http://support.microsoft.com/kb/324277"&gt;http://support.microsoft.com/kb/324277&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2143050" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/lprete/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.iis.net/lprete/archive/tags/Metabase/default.aspx">Metabase</category><category domain="http://blogs.iis.net/lprete/archive/tags/MachineKeys/default.aspx">MachineKeys</category></item></channel></rss>