IIS7中Integrated和classic的区别 >>

 当我们在.net里使用SmtpClient发送邮件时都能得到正确的邮件,但是上传到godaddy后就不能用上,会发生如下错误:

System.Security.SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Net.Mail.SmtpClient.set_Port(Int32 value)
at ScrewTurn.Wiki.EmailSender.GenerateSmtpClient() in C:\Documents and Settings\Administrator\桌面\2.0.36 Source\Core\EmailSender.cs:line 72
at ScrewTurn.Wiki.EmailSender.TrySendMessage(MailMessage message) in C:\Documents and Settings\Administrator\桌面\2.0.36 Source\Core\EmailSender.cs:line 55
The action that failed was:
Demand
The type of the first permission that failed was:
System.Net.Mail.SmtpPermission
The Zone of the assembly that failed was:
MyComputer

这是怎么回事?从字面意义上看好象System.Net.Mail的权限不够,需要给以更高的权限,我在网上找了以后也是这样的答案,在 web.config文件里添加权限设置,但是godaddy不允许。可能是为了安全考虑吧,所以我给godaddy客服发了求救邮件,得到了解决,具体 方法很简单,如下:

只要将SMTP服务器使用:relay-hosting.secureserver.net,端口设为25即可。
费了这么大力气在网上找答案,还不如给客服写封信呢,真是费力不讨好啊,呵呵。


以上转自:胡其图的博客
原文链接:http://blog.noruu.com/huqitu/blog/post/2009/01/19/godaddye8999ae68b9fe7a9bae4b8ade794a8net-SmtpCliente58f91e98081e982aee4bbb6e8a7a3e586b3e696b9e6b395.aspx

 

 godaddy发邮件

正好也遇到这问题,搜索到了这篇文章,用godaddy赠送的邮件服务测试通过

Comments (2) -

zsk
zsk People's Republic of China
1/30/2010 5:51:29 PM #

I'm testing

Reply

zsk
zsk People's Republic of China
1/30/2010 5:53:25 PM #

hello test

Reply

Add comment

  Country flag

biuquote
Loading

赞助商链接

©2009 - 2011 Themes by redfox66.com Powered by BlogEngine.NET ver:2.5.0.8 Log in
无觅相关文章插件,快速提升流量