我正在使用 Enterprise Library 6.0。当我使用电子邮件跟踪监听器时,我得到一个 ArgumentException
The parameter 'address' cannot be an empty string.
我的配置:
<add name="Email Trace Listener"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
toAddress="testemail1@test.org;testemail2@test.org;"
subjectLineStarter="IMD.PP"
subjectLineEnder="Local"
fromAddress="testfrom@test.org"
smtpServer="smtpserver.test.org"
formatter="Text Formatter" />
最佳答案
原因是 toAddress 末尾的额外分号,当我删除那个分号时,它开始工作了:
<add name="Email Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" toAddress="testemail1@test.org;testemail2@test.org" subjectLineStarter="IMD.PP" subjectLineEnder="Local" fromAddress="testfrom@test.org" smtpServer="smtpserver.test.org" formatter="Text Formatter" />
关于c# - 使用企业库电子邮件跟踪监听器时获取 ArgumentException "The parameter ' 地址'不能为空字符串",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37519469/