<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>疑难杂症</title><link>http://webuc.net/chinahuman/category/516.aspx</link><description>疑难杂症</description><managingEditor>铁匠</managingEditor><dc:language>af</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>铁匠</dc:creator><title>httphandler的怪问题</title><link>http://webuc.net/chinahuman/archive/2009/05/01/10462.aspx</link><pubDate>Fri, 01 May 2009 10:26:00 GMT</pubDate><guid>http://webuc.net/chinahuman/archive/2009/05/01/10462.aspx</guid><wfw:comment>http://webuc.net/chinahuman/comments/10462.aspx</wfw:comment><comments>http://webuc.net/chinahuman/archive/2009/05/01/10462.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://webuc.net/chinahuman/comments/commentRss/10462.aspx</wfw:commentRss><trackback:ping>http://webuc.net/chinahuman/services/trackbacks/10462.aspx</trackback:ping><description>&lt;P&gt;我维护的某个程序的某个httphandler需要作修改了，就是在出错三次后，需要增加图形验证码，图验正确后才继续往后台的服务发送验证信息。因为里面的逻辑比较复杂，所以我就增加了两个变量，一个是是否有图验，另一个是图验是否正确。三分钟就修改完了代码，自测了一把，一切OK，于是提交更新。过一分儿测试组的就传来消息，现在图验只出一次，以后再怎么错，就不再出图验了。&lt;/P&gt;
&lt;P&gt;我首先怀疑是不是程序的代码不一致引起的，于是到环境上把DLL取下来，反编译，查看逻辑，一切都是一样的。&lt;/P&gt;
&lt;P&gt;最后发现上面的IsReUseable 被置成了true.原来问题是出在这里。当这个属性被置成true后，所有的对象被创建的时候，就会放在一个对象池里，有新的请求的时候，就从池里面去取一个现成的来处理，只有当发现对象池的对象不够用的时候，才会继续创建新的对象。&lt;/P&gt;&lt;img src ="http://webuc.net/chinahuman/aggbug/10462.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>铁匠</dc:creator><title>奇怪的函数入口点找不到问题</title><link>http://webuc.net/chinahuman/archive/2009/05/01/10461.aspx</link><pubDate>Fri, 01 May 2009 02:17:00 GMT</pubDate><guid>http://webuc.net/chinahuman/archive/2009/05/01/10461.aspx</guid><wfw:comment>http://webuc.net/chinahuman/comments/10461.aspx</wfw:comment><comments>http://webuc.net/chinahuman/archive/2009/05/01/10461.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://webuc.net/chinahuman/comments/commentRss/10461.aspx</wfw:commentRss><trackback:ping>http://webuc.net/chinahuman/services/trackbacks/10461.aspx</trackback:ping><description>&lt;p&gt;系统又要升级了，编码，测试一切好像都很正常，正当准备要上线的时候，突然发现有一个功能不能用了。这个功能就是使用HTTPS去调别的服务的WebServices。根据程序记下来的日志发现了这样的一个错误：&lt;/p&gt; &lt;div style="background-color: #eeeeee"&gt;Catched Exception: [System.Net.WebException]: "基础连接已经关闭: 接收时发生错误。" in &amp;lt;System.Web.Services&amp;gt; &lt;br&gt;System.Net.WebException: 基础连接已经关闭: 接收时发生错误。 ---&amp;gt; System.EntryPointNotFoundException: 无法在 DLL“security.dll”中找到名为“EnumerateSecurityPackagesW”的入口点。&lt;br&gt;&amp;nbsp;&amp;nbsp; 在 System.Net.UnsafeNclNativeMethods.SafeNetHandles_SECURITY.EnumerateSecurityPackagesW(Int32&amp;amp; pkgnum, SafeFreeContextBuffer_SECURITY&amp;amp; handle)&lt;br&gt;&amp;nbsp;&amp;nbsp; 在 System.Net.SafeFreeContextBuffer.EnumeratePackages(SecurDll Dll, Int32&amp;amp; pkgnum, SafeFreeContextBuffer&amp;amp; pkgArray)&lt;br&gt;&amp;nbsp;&amp;nbsp; 在 System.Net.SSPISecureChannelType.EnumerateSecurityPackages(Int32&amp;amp; pkgnum, SafeFreeContextBuffer&amp;amp; pkgArray)&lt;br&gt;&amp;nbsp;&amp;nbsp; 在 System.Net.SSPIWrapper.EnumerateSecurityPackages(SSPIInterface SecModule)&lt;br&gt;&amp;nbsp;&amp;nbsp; 在 System.Net.SSPIWrapper.GetVerifyPackageInfo(SSPIInterface secModule, String packageName, Boolean throwIfMissing)&lt;br&gt;&amp;nbsp;&amp;nbsp; 在 System.Net.Security.SecureChannel..ctor(String hostname, Boolean serverMode, SchProtocols protocolFlags, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, Boolean remoteCertRequired, Boolean checkCertName, Boolean checkCertRevocationStatus, LocalCertSelectionCallback certSelectionDelegate)&lt;br&gt;&amp;nbsp;&amp;nbsp; 在 System.Net.Security.SslState.ValidateCreateContext(Boolean isServer, String targetHost, SslProtocols enabledSslProtocols, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, Boolean remoteCertRequired, Boolean checkCertRevocationStatus, Boolean checkCertName)&lt;br&gt;&amp;nbsp;&amp;nbsp; 在 System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)&lt;br&gt;&amp;nbsp;&amp;nbsp; 在 System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)&lt;br&gt;&amp;nbsp;&amp;nbsp; 在 System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)&lt;br&gt;&amp;nbsp;&amp;nbsp; 在 System.Net.ConnectStream.WriteHeaders(Boolean async)&lt;br&gt;&amp;nbsp;&amp;nbsp; --- 内部异常堆栈跟踪的结尾 ---&lt;/div&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;在同一台机器上的旧版程序，相同的代码，确可以正常使用。也是用同一个应用程序池（asp.net的程序），可以排除权限的问题。最后突然想到系统加载security.dll的时候，会不会不是加载的是系统的那个？于是再看一下程序的bin目录下，发现有一个同名的DLL，把它改名后，发现问题依旧，于是到%windir%/microsoft.net/framework/下面的asp.net cache目录下面把临时文件清除后，解决问题。&lt;/p&gt; &lt;p&gt;让我们顺路看看程序加载一个DLL的查找顺序吧。我用程序去引用一个根本不存在的dll，然后用filemon去看文件句柄的查找顺序：&lt;/p&gt; &lt;p&gt;D:\PersonWork\ForTest\ConsoleApplication1\bin\Debug\ironsoftEncryp.dll&lt;br&gt;D:\PersonWork\ForTest\ConsoleApplication1\bin\Debug\ironsoftEncryp.dll&lt;br&gt;D:\PersonWork\ForTest\ConsoleApplication1\bin\Debug\ironsoftEncryp.dll&lt;br&gt;C:\Windows\System32\ironsoftEncryp.dll&lt;br&gt;C:\Windows\system\ironsoftEncryp.dll&lt;br&gt;C:\Windows\ironsoftEncryp.dll&lt;br&gt;D:\PersonWork\ForTest\ConsoleApplication1\bin\Debug\ironsoftEncryp.dll&lt;br&gt;C:\Program Files\Borland\Delphi7\Bin\ironsoftEncryp.dll&lt;br&gt;C:\Program Files\Borland\Delphi7\Projects\Bpl\ironsoftEncryp.dll&lt;br&gt;C:\Windows\System32\ironsoftEncryp.dll&lt;br&gt;C:\Windows\ironsoftEncryp.dll&lt;br&gt;C:\Windows\System32\wbem\ironsoftEncryp.dll&lt;br&gt;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\ironsoftEncryp.dll&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\ironsoftEncryp.dll&lt;br&gt;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\ironsoftEncryp.dll&lt;br&gt;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\ironsoftEncryp.dll&lt;br&gt;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\ironsoftEncryp.dll &lt;p&gt;可以总结一下查找顺序： &lt;p&gt;1. 可执行文件所在目录； &lt;p&gt;2．进程当前目录； &lt;p&gt;3．系统目录，%SystemRoot%/system32 &lt;p&gt;4．16位系统目录；，%SystemRoot%/system &lt;p&gt;5．Windows目录，%SystemRoot%/ &lt;p&gt;6．环境变量PATH中的目录；&lt;/p&gt;&lt;img src ="http://webuc.net/chinahuman/aggbug/10461.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>