铁匠

做人要低调
随笔 - 139, 评论 - 611 , 引用 - 185

导航

公告

文章分类

存档

随笔分类

相册

BLOG

网站

论坛

奇怪的函数入口点找不到问题

系统又要升级了,编码,测试一切好像都很正常,正当准备要上线的时候,突然发现有一个功能不能用了。这个功能就是使用HTTPS去调别的服务的WebServices。根据程序记下来的日志发现了这样的一个错误:

Catched Exception: [System.Net.WebException]: "基础连接已经关闭: 接收时发生错误。" in <System.Web.Services>
System.Net.WebException: 基础连接已经关闭: 接收时发生错误。 ---> System.EntryPointNotFoundException: 无法在 DLL“security.dll”中找到名为“EnumerateSecurityPackagesW”的入口点。
   在 System.Net.UnsafeNclNativeMethods.SafeNetHandles_SECURITY.EnumerateSecurityPackagesW(Int32& pkgnum, SafeFreeContextBuffer_SECURITY& handle)
   在 System.Net.SafeFreeContextBuffer.EnumeratePackages(SecurDll Dll, Int32& pkgnum, SafeFreeContextBuffer& pkgArray)
   在 System.Net.SSPISecureChannelType.EnumerateSecurityPackages(Int32& pkgnum, SafeFreeContextBuffer& pkgArray)
   在 System.Net.SSPIWrapper.EnumerateSecurityPackages(SSPIInterface SecModule)
   在 System.Net.SSPIWrapper.GetVerifyPackageInfo(SSPIInterface secModule, String packageName, Boolean throwIfMissing)
   在 System.Net.Security.SecureChannel..ctor(String hostname, Boolean serverMode, SchProtocols protocolFlags, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, Boolean remoteCertRequired, Boolean checkCertName, Boolean checkCertRevocationStatus, LocalCertSelectionCallback certSelectionDelegate)
   在 System.Net.Security.SslState.ValidateCreateContext(Boolean isServer, String targetHost, SslProtocols enabledSslProtocols, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, Boolean remoteCertRequired, Boolean checkCertRevocationStatus, Boolean checkCertName)
   在 System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
   在 System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   在 System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   在 System.Net.ConnectStream.WriteHeaders(Boolean async)
   --- 内部异常堆栈跟踪的结尾 ---

 

在同一台机器上的旧版程序,相同的代码,确可以正常使用。也是用同一个应用程序池(asp.net的程序),可以排除权限的问题。最后突然想到系统加载security.dll的时候,会不会不是加载的是系统的那个?于是再看一下程序的bin目录下,发现有一个同名的DLL,把它改名后,发现问题依旧,于是到%windir%/microsoft.net/framework/下面的asp.net cache目录下面把临时文件清除后,解决问题。

让我们顺路看看程序加载一个DLL的查找顺序吧。我用程序去引用一个根本不存在的dll,然后用filemon去看文件句柄的查找顺序:

D:\PersonWork\ForTest\ConsoleApplication1\bin\Debug\ironsoftEncryp.dll
D:\PersonWork\ForTest\ConsoleApplication1\bin\Debug\ironsoftEncryp.dll
D:\PersonWork\ForTest\ConsoleApplication1\bin\Debug\ironsoftEncryp.dll
C:\Windows\System32\ironsoftEncryp.dll
C:\Windows\system\ironsoftEncryp.dll
C:\Windows\ironsoftEncryp.dll
D:\PersonWork\ForTest\ConsoleApplication1\bin\Debug\ironsoftEncryp.dll
C:\Program Files\Borland\Delphi7\Bin\ironsoftEncryp.dll
C:\Program Files\Borland\Delphi7\Projects\Bpl\ironsoftEncryp.dll
C:\Windows\System32\ironsoftEncryp.dll
C:\Windows\ironsoftEncryp.dll
C:\Windows\System32\wbem\ironsoftEncryp.dll
C:\Program Files\Microsoft SQL Server\80\Tools\Binn\ironsoftEncryp.dll   
C:\Program Files\Microsoft SQL Server\80\Tools\Binn\ironsoftEncryp.dll
C:\Program Files\Microsoft SQL Server\90\Tools\Binn\ironsoftEncryp.dll
C:\Program Files\Microsoft SQL Server\90\DTS\Binn\ironsoftEncryp.dll
C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\ironsoftEncryp.dll

可以总结一下查找顺序:

1. 可执行文件所在目录;

2.进程当前目录;

3.系统目录,%SystemRoot%/system32

4.16位系统目录;,%SystemRoot%/system

5.Windows目录,%SystemRoot%/

6.环境变量PATH中的目录;

发表于 2009年5月1日 2:17

评论

# re: 奇怪的函数入口点找不到问题

收藏之,谢谢
2009/7/12 10:18 | 凡客

# re: 奇怪的函数入口点找不到问题

good,很好
2009/8/23 10:48 | 春水堂

# t shirt printing uk

I visited lot of site and read lot of article. I am really happy for this post in this site. So i always want to concentrate in this site about different article.
2011/12/9 18:53 | t shirt printing uk

# coach outlet online

The most incredible knack about the coach bag of coach outlet online is that it would excellently please your minds beyond your mind's eye. For example, if you want to become the Angelina Julie, you will immediately need to wear the coach handbag around your shoulder.On establishing contact with a coach outlet hire agency, a few clarifications would need to be put to rest prior to working out a deal.
2012/1/6 11:21 | coach outlet online

# louis vuitton outlet

In the web times, even if you are a noble person on
louis vuitton outlet

, or to real action to prove himself, has been integrated into a new era.If in a foreign country to join the twitter, it is best to join army of micro-Bo;They're not chosen, so one of these ideal for you.For more flexibleness a lot more like these, there are lots of discount 'shoulder' variations outlet
louis vuitton bags

.
http://www.louisvuittonoutletbagsu.com
2012/1/6 11:53 | louis vuitton outlet

# coach outlet online

At the
coach outlet online

you have the largest selection of the day. If you touch the item and like it, keep it in your possession until you make your final decision.In particular, products from
coach factory outlet

with leather design are fashionable, handmade,leading the wave of American pop.It with simple,durable and unique style to win consumers.
http://www.coachoutletonlineusacoach.com
2012/1/6 11:53 | coach outlet online

# louis vuitton sale

There must be one louis vuitton vernis that is sure to fit your style. louis vuitton sale provide Louis Vuitton belt for men has royal purple lining, which could burnish whatever clothes.As we show below, louis vuitton outlet have a number of Louis Vuitton Earrings, louis vuitton replica handbags, in different styles for your selection.
http://www.louisvuittonoutletsaletime.com
2012/1/6 13:19 | louis vuitton sale

# coach factory outlet

Welcome to the coach factory outlet store and Enjoy Shopping Here! We promise all the customers to have the superior qualities and low prices.Many people like to go to coach factory online, Some people like to designers and shiny metal or leather coach shoulder bags. However, the majority of women choose to safe the neuter color coach shoulder bags. http://www.coachfactoryoutletlove.com
2012/1/6 13:23 | coach factory outlet

# louis vuitton uk

As we know,
louis vuitton uk

as we can imagine are a little expensive but are of good quality like the brand Coach. It's really a good choice to shopping in Louis Vuitton outlet.
louis vuitton

Outlets offer famous classic brand for LV,Channel, with perfect service.So become to the VIP soon.They offer more new styles,like LV purses,LV wallets etc. And are tested by product quality monitoring center .
http://www.louisvuitton-ukoutlet.org.uk
2012/1/6 13:29 | louis vuitton uk

# coach outlet store

Coach Outlet Store vision system is a visual enjoy, is a visual art. The particular design has been integrated function and the element of elegancy, then show you an exquisite and excellent product. You need not worry about the quality of the coach outlet store online for sale now. The Coach brand is famous for the perfect products.

2012/1/6 14:11 | coach outlet store

# coach outlet

if your dream is to look like a million bucks for a mere several dollars, then our coach outlet store is the Jiminy Cricket of your existence. to obtain coach outlet online in Hainan is amongst the brand new darling from residential holiday makers.


2012/1/6 14:11 | coach outlet

# coach factory outlet

Coach Factory Outlet has a big heart and a healthy appetite, and a wicked swing with a chainsaw.
2012/1/7 16:44 | coach factory outlet

Post Comment

主题  
姓名  
主页
校验码  
内容   
京ICP备 05050892号