无法获取 IIS 拾取目录

Cannot get IIS pickup directory(无法获取 IIS 拾取目录)
本文介绍了无法获取 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 拾取目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)
Bind multiple parameters from route and body to a model in ASP.NET Core(在ASP.NET Core中将路由和主体中的多个参数绑定到一个模型)
Custom model binding in AspNet Core WebApi?(AspNet Core WebApi中的自定义模型绑定?)
How to minify in .net core mvc view?(如何在.Net核心MVC视图中缩小?)