• 项目中的security.dll与.net框架中的项目冲突


    今天在项目中做模拟发送请求,使用了HttpWebRequest 与HttpWebResponse两个类进行发送,当使用了GetResponse()方式时,程序内部立即就报“基础连接已经关闭: 接收时发生错误”
     
    久违了的错误又出现了,具体的错误如下:
     
    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)
       --- 内部异常堆栈跟踪的结尾 ---
     
     
    解决过程:
     
    环境:windows2003,vs2008
     
    查找所有项目,查找所有生成“security.dll”的项目,将此DLL删除(如果是项目生成,将该项目的程序集名字换一个不要叫security,免得与微软的冲突)
     
    本来进行了上面的操作后,按道理是能正常调用前面说的那两个类,但是还出现相同的问题,网上查了下资料又与同事进行了讨论下,发现vs在编译或者调
     
    试的时候会在“Temporary ASP.NET Files”文件加入相应的dll信息,结果就在此文件夹中还存在“security.dll”,此地方的这个dll一定要删,要不然是没
     
    有作用的,所以这个“临时的security.dll”一定要删除,由于用的VS2008所以完整的删除地址为C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
     
    \Temporary ASP.NET Files,然后在这个文件夹中搜索此dll删除,至此“基础连接已经关闭: 接收时发生错误”解决

    专注 + 保持追求精益求精的精神 + 完美的心态 == 天才

  • 相关阅读:
    CentOS 7.3报Centos7_Base库缺少GPG公钥
    nginx重写(隐藏)index.php目录
    工作经历简写
    Centos7.4安装htop
    nginx 超时时间配置说明
    c#中数据从数据库到客户端主要几种的导出方式(导出到excel,导出到word)
    C#操作word文档如何设置表格的行高
    Windows计划任务定时启动程序运行时发生错误的解决办法
    Asp.Net MVC中请求json文件时返回404 not found的解决办法
    Angularjs 如何自定义Img的ng-load 事件
  • 原文地址:https://www.cnblogs.com/NoRoad/p/2078452.html
Copyright © 2020-2023  润新知