当我将我的网站发布到 Windows azure 时,ELMAH 不发送电子邮件并引发以下错误。任何帮助或想法表示赞赏。谢谢你!
笔记:
我已经正确设置了 elmah 以通过 hostmysite.com 上的 smtp 发送电子邮件,它在 Azure 之外进行 IIS/.NET 托管。我家里也有一台运行良好的登台服务器。此外,我尝试了端口 25,50、587。此外,我尝试发送到我支付的列表服务器以及 SendGrid。在每种情况下,它都适用于我的登台和开发服务器,但不适用于 Azure。
ELMAH 正在捕获数据库中的错误(Azure 中的 MS SQL 和 IIS)。
这是我的配置设置:
System.Net.NetworkInformation.NetworkInformationExceptionAccess is denied
System.Net.NetworkInformation.NetworkInformationException (0x80004005): Access is denied
at System.Net.NetworkInformation.SystemIPGlobalProperties.GetFixedInfo()
at System.Net.NetworkInformation.SystemIPGlobalProperties.get_FixedInfo()
at System.Net.NetworkInformation.SystemIPGlobalProperties.get_HostName()
**at System.Net.Mail.SmtpClient.Initialize()
at System.Net.Mail.SmtpClient..ctor()
at Elmah.ErrorMailModule.SendMail(MailMessage mail)
at Elmah.ErrorMailModule.ReportError(Error error)**
at Elmah.ErrorSignalEventHandler.Invoke(Object sender, ErrorSignalEventArgs args)
at Elmah.Mvc.HandleErrorAttribute.OnException(ExceptionContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext, IList`1 filters, Exception exception)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
...
</httpModules>
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
...
</modules>
<elmah>
<security allowRemoteAccess="yes" />
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Elmah.Sql" />
**<errorMail from="errors@domain.com" to="ErrorReport@mydomain.com" subject="[Site][ErrorReport-ELMAH]" async="false" smtpPort="587" smtpServer="stmp.server.com" useSsl="false" userName="user1" password="password1" noYsod="false" />**
</elmah>