IIS7应用程序发送邮件失败
时间:2011-12-13
来源:互联网
已经装了IIS的邮件服务器,在IIS7下面有一个网站,运行的很正常,可以发送邮件,但是在这个网站的下面再建立一个应用程序,子站点就发送不了邮件了,提示:
邮件发送失败,没有识别提供给安全包的凭证
at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean throwOnError, SecurityStatus& statusCode)
at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob)
at System.Net.Mail.SmtpNtlmAuthenticationModule.Authenticate(String challenge, NetworkCredential credential, Object sessionCookie, String spn, ChannelBinding channelBindingToken)
at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
以下是发送代码:
C# code
父站点和子站点代码是一样的(包括这段邮件发送代码),可就是发送不了,IIS7应用程序池用的是各自的,版本为4.0,集成模式,很奇怪,求解答!
另外如果web.config中的connectionStrings的name相同也会报错,必须在子站点的前面加上<clear/>,为什么?IIS7的应用程序和父站点不是互相独立的吗?
邮件发送失败,没有识别提供给安全包的凭证
at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean throwOnError, SecurityStatus& statusCode)
at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob)
at System.Net.Mail.SmtpNtlmAuthenticationModule.Authenticate(String challenge, NetworkCredential credential, Object sessionCookie, String spn, ChannelBinding channelBindingToken)
at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
以下是发送代码:
C# code
System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~/"); SmtpSection cfg = NetSectionGroup.GetSectionGroup(config).MailSettings.Smtp; SmtpNetworkElement network = cfg.Network; SmtpClient smtp = new SmtpClient(network.Host); smtp.Credentials = new System.Net.NetworkCredential(network.UserName, network.Password); smtp.Credentials = new System.Net.NetworkCredential(); MailAddress from = new MailAddress(cfg.From); MailMessage message = new MailMessage(); message.From = from; message.To.Add(new MailAddress(config.AppSettings.Settings["MAIL"].Value)); message.IsBodyHtml = true; message.Subject = subject; message.Body = body; smtp.Send(message);
父站点和子站点代码是一样的(包括这段邮件发送代码),可就是发送不了,IIS7应用程序池用的是各自的,版本为4.0,集成模式,很奇怪,求解答!
另外如果web.config中的connectionStrings的name相同也会报错,必须在子站点的前面加上<clear/>,为什么?IIS7的应用程序和父站点不是互相独立的吗?
作者: BATTLERxANGE 发布时间: 2011-12-13
哦补充以下,子站点的web.config和父站点的是一样的,包括<mailSettings>节点的邮件配置也是,完全一模一样,可是子站点就是发送不了。
作者: BATTLERxANGE 发布时间: 2011-12-13
你都未用本机的Smtp服务
作者: net5354 发布时间: 2011-12-13
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28