2013-07-16 113 views
0

我写了一个ASP.NET,每12小时发送一次SMTP邮件。它在我的办公室服务器上正常工作,但是当我在客户端服务器上运行解决方案时,它显示错误“远程证书根据验证程序无效“。会有什么问题以及解决方案是什么?发送电子邮件时出错

+0

它不会“显示您的错误”,它会引发异常。请发布完整的例外。 –

+0

客户端是否为其邮件服务器使用自签名证书?其中之一很可能是问题:http://stackoverflow.com/a/9983342/264607 – BlackICE

回答

0

有几个问题在那里已经

(什么检查大反馈) The remote certificate is invalid according to the validation procedure

(代码在非PROD运行,让过去的错误) "The remote certificate is invalid according to the validation procedure." using Gmail SMTP server

(附加信息)The remote certificate is invalid according to the validation procedure

如果T软管不起作用

尝试服务器

  1. 证书保存到你的电脑,你需要添加 证书上也添加了证书。
  2. 开始 - >运行 - > MMC这将打开Microsoft 管理控制台
  3. 转到文件 - >添加/删除管理单元...选择从可用的管理单元 证书:复选框,然后单击添加>
  4. 您将有三个选项(用户,服务,计算机),选择计算机 帐户,点击Next> .Hit完成关闭对话框,并确定以 关闭Snap-in对话框
  5. 右键点击受信任的根证书颁发 权限 - >所有任务 - >导入...
  6. 点击下一步>,浏览证书,然后点击下一步,直到对话框关闭,并且您已成功添加证书 。

运行跟踪来见错误信息

以下内容添加到你的web.config。 (摘自here

<system.diagnostics> 
    <trace autoflush="true" /> 
      <sources> 
      <source name="System.Net"> 
        <listeners> 
      <add name="System.Net"/> 
        </listeners> 
      </source> 
      <source name="System.Net.HttpListener"> 
        <listeners> 
      <add name="System.Net"/> 
        </listeners> 
      </source> 
    <source name="System.Net.Sockets"> 
        <listeners> 
      <add name="System.Net"/> 
        </listeners> 
      </source> 
    <source name="System.Net.Cache"> 
        <listeners> 
      <add name="System.Net"/> 
        </listeners> 
      </source> 
      </sources> 
    <sharedListeners> 
      <add 
      name="System.Net" 
      type="System.Diagnostics.TextWriterTraceListener" 
       initializeData="System.Net.trace.log" 
      traceOutputOptions = "ProcessId, DateTime" 
      /> 
    </sharedListeners> 
<switches> 
    <add name="System.Net" value="Verbose" /> 
    <add name="System.Net.Sockets" value="Verbose" /> 
    <add name="System.Net.Cache" value="Verbose" /> 
    <add name="System.Net.HttpListener" value="Verbose" /> 
</switches> 
</system.diagnostics> 

这会让你仔细看看有什么不对。即。名称不匹配等。确保将initializeData =“System.Net.trace.log”更改为日志的位置,并确保网络服务具有r/w访问权限。