无法获取 IIS 拾取目录

8

本文介绍了无法获取 IIS 拾取目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我一直在使用 Smtp 服务器 127.0.0.1 .我得到的错误:

I’ve been using the Smtp server 127.0.0.1 .The error I get:

System.Net.Mail.SmtpException: 无法在 System.Net.Mail.IisPickupDirectory.GetPickupDirectory() 获取 IIS 分拣目录.

此错误发生在从 ASP 网页发送电子邮件时.但从 ASP.NET 页面发送电子邮件时,没有发生错误.请帮忙.

This Error occured ,when Email send from ASP web page.But EMail send from ASP.NET page,error is not occurred. Plz help .

推荐答案

不幸的是,当尝试确定 IIS/SMTP 拾取目录的位置时出现任何类问题时,会引发此异常.一个常见的原因是缺少 IIS SMTP 服务.

Unfortunately, this exception is raised when any kind of problem occurs while trying to determine the location of IIS/SMTP pickup directory. A common cause is missing IIS SMTP service.

如果您使用 System.Net.Mail.SmtpClient 发送邮件,请尝试手动设置取件目录:

If you are sending mail using System.Net.Mail.SmtpClient, try setting the pickup directory manually:

// C#
var client = new SmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
client.PickupDirectoryLocation = ...;
client.Send(...);

或者改为在 ASP.NET 的 Web.config 中设置:

Or set this in ASP.NET's Web.config instead:

<configuration>
    <system.net>
        <mailSettings>
            <smtp deliveryMethod="SpecifiedPickupDirectory">
                <specifiedPickupDirectory
                    pickupDirectoryLocation="..." />
                <network defaultCredentials="false" />
            </smtp>
        </mailSettings>
    </system.net>
</configuration> 

或者,使用 SmtpDeliveryMethod.Network 方法并将 HostPort 属性发送到您的 SMTP 服务器.

Alternatively, use SmtpDeliveryMethod.Network method instead and sent the Host and Port properties to your SMTP server.

更多信息:http://forums.iis.net/p/1149338/1869548.aspx

这篇关于无法获取 IIS 拾取目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

函数委托与函数
Func Delegate vs Function(函数委托与函数)...
2023-11-11 C#/.NET开发问题
6

针对委托检查 MethodInfo
Checking a MethodInfo against a delegate(针对委托检查 MethodInfo)...
2023-11-11 C#/.NET开发问题
7

如何从 lambda 表达式中获取引用实例的实例
How to get the instance of a referred instance from a lambda expression(如何从 lambda 表达式中获取引用实例的实例)...
2023-11-11 C#/.NET开发问题
4

如何为具有空目标的实例方法创建委托?
How to create a delegate to an instance method with a null target?(如何为具有空目标的实例方法创建委托?)...
2023-11-11 C#/.NET开发问题
6