IIS 7 and Above
LM/SmtpSvc key missing from Metabase
Last post May 15, 2008 04:58 PM by anilr
May 14, 2008 06:30 AM|ventalator|LINK
In short my problem is that my metabase was missing the LM/SmtpSvc key and i was wondering how it normally gets created without manual insertion. Read below for a more detailed progression of my problem:
I've recently upgraded from xp pro to vista ultimate, installed every iis component etc and got my .net 2 apps working more or less correctly on my new setup. However i ran into a small problem with sending email via smtp.
Like many others, i was late to discover that vista did not come with an smtp vitual server like xp pro, but i did notice that IIS7 has an SMTP E-mail section where you can define a pickup directory. This was fine because my company's apps use the iispickup
So i created a directory for my pickups "C:\inetpub\mailroot\pickup" and gave it the correct permissions and pointed IIS7 to this directory. But to my dismay, when i ran my application and tried to send an email an SmtpException was thrown "Cannot get IIS
pickup directory". Oh noes!
So after a bit of googling and the usual "make sure your permissions to the directory are correct" etc i finally found a post that referred to the user having correct permissions to access the Metabase key. Being a noob i wasn't quite sure what this was but
i learnt quickly and gained access via the Metabase explorer. I gave permissions to everything i could. Didnt work. So i decided to dissasemble the System.Net.Mail.SmtpClient Send method, quickly found the GetIIsPickupDirectory and replicated that in my code.
This wasn't really necessary because after a quick look at the disassembled code i could see that it was trying to read the metabase key "LM/SmtpSvc" which i had a look for in my metabase but it didn't exist! So i created the necessary keys to point to the
pickup directory (based off what i saw on another xp computer) and wala, everything working again.
My question is then... what did i do wrong in the first place to be missing this key? All other vista machines in our business have the exact same problem so it's either a bug or we're setting up IIS7 incorrectly. I believe that IIS7 doesn't use the metabase
any more and it uses its own configuration files... but because the .NET code only references keys in the IIS6 metabase i became a bit confused...
Any help much appreciated.
May 15, 2008 01:04 AM|davcox|LINK
So are these other machines also doing upgrades from XP Pro to Vista Ultimate?
The old SMTP Service no longer ships on Vista versions (the "client" SKU's of Windows), the team supporting it (not IIS) decided not to ship it anymore.
So the fact that you got this to work is great! I'm impressed. :)
Was the metabase.xml file somehow changed between upgrades?
What I am guessing happened is that this metabase.xml somehow was corrupted on upgrade. To save some hassle, save off the metabase.xml from your XP machine before upgrading and then re-apply any "broken" parts to Vista.
May 15, 2008 01:29 AM|ventalator|LINK
Thanks for the reply davcox!
I kinda goofed up by saying I "upgraded" from xp pro to vista. What I meant to say was that i was previously using xp pro and i was familiar with the IIS configuration on that OS. I did a full format before installing vista ultimate so i started with a
clean slate. Each other machine in the office has also been completely formatted before installing vista. All have the same problem I had with finding the pickup directory defined in IIS7.
So i was wondering what exactly does the Smtp E-mail - "Store email in pickup directory" setting in IIS7 do? I did notice that if you do set a directory, IIS7 attempts to insert the following code into your web.config:
<specifiedPickupDirectory pickupDirectoryLocation="C:\inetpub\mailroot\pickup" />
<network defaultCredentials="false" />
But after looking at the GetIIsPickupDirectory in System.Net.Mail it appears that it makes absolutely no reference to your config settings and only checks the metabase. Weird huh?
So i'm guessing that because Vista doesn't ship with an Smtp Virtual server, that the Smtp E-mail - "Store email in pickup directory" setting is only supposed to be used in relation to a Smtp server you've manually installed your self? Maybe?... I'm so
Oh thought i should mention that our applications are running in the classic .net app pool using .net 2.0
May 15, 2008 04:58 PM|anilr|LINK
If you use SmtpDeliveryMethod of SpecifiedPickupDirectory instead of PickupDirectoryFromIis - the directory specified in system.net/mailSettings config section will be used - since there is no smtp server on vista - the metabase location for "IIS" smtp service
do not exist - you have managed to hack the registry to make the "IIS" pickup location work, but that is just a hack without the presence of an smtp server which picks up mail from that location.