Problem with SMTP in IIS7
I have an ASP.NET app that works fine on my windows XP dev machine but doesn't work when deployed to a Windows 2008 with IIS7. The app uses SmtpDeliveryMethod.PickupDirectoryFromIis and gives an error when I try to send an email from the app on IIS7 (an SmtpException with the message "cannot get iis pickup directory"). I use the same settings on both the dev machine and t开发者_StackOverflowhe server.
Any help would be really appreciated ...
It turned out to be a permissions problem but not with the pickup directory, actually with the metabase (SMTP settings are still saved in the metabase in IIS7)
I came across this forum thread, Cannot get IIS pickup directory. NEED HELP, on IIS.net forums website then followed what was mentioned in the posts, downloaded and installed the metabase explorer tool (you have to download IIS6 resource kit to get it) then gave read permissions to my custom user (as indicated in one of the posts) on the LS, SMTPSvc and SMTPSvc/1 keys and it worked. For some unknown reason if you only give permissions to the smptSvc key it doesn't work.
I think the problem could be with trust levels.
Because in medium trust you can only write to your application's directory (or any directory below that). And if the PickUp folder which you specified is not in your application's directory AND the application is running under medium trust (not full trust), then you can't write to the PickUp folder.
You may send directly to the SMTP server without using a pickup directory.
You need to specify the Pickup directory first. Here's a guide on how to do it.
Also it's not a good idea to compare your IIS 5.1 on an XP box against the one on your Windows Server 2008 (IIS 7), since besides the obvious version difference a lot of features have changed a lot. Specially the smtp server, for instance there's no such feature in Vista.
精彩评论