tags:

views:

1139

answers:

4

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 the server.

Any help would be really appreciated ...

A: 

You may send directly to the SMTP server without using a pickup directory.

123
Thanks for your answer but I have my reasons to use the pickup directory.
Waleed Eissa
A: 

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.

çağdaş
Thanks for your answer but actually this is a dedicated server. The ASP.NET account has permissions to write to the pickup directory.
Waleed Eissa
I see. BTW, have you checked that a pickup directory is specified on IIS Manager under SMTP E-mail settings?
çağdaş
Thanks for noting that, actually I didn't have it specified. I specified the pickup directory in IIS manager but unfortunately still getting the same error.
Waleed Eissa
but actually I don't think I have to specify the pickup directory because I don't have it specified on my dev machine but it's working though.
Waleed Eissa
A: 

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.

Raúl Roa
Thanks a lot for your answer. I know it's not a good idea to compare an old version to a new version but actually I'm not comparing IIS 5.1 to IIS 7, I'm only comparing SMTP which I believe didn't really change much or probably at all (for example you still have to access SMTP settings in Windows 2008 from the IIS 6 Manager)
Waleed Eissa
Actually specifying a pickup directory is not required, it worked without doing that
Waleed Eissa
+1  A: 

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.

Waleed Eissa