0
我有一个Windows应用程序,它使得HTTP帖子发送和接收一些XML。在Windows PC上它可以正常工作,但是由于将其移动到测试服务器(Windows 2008 R2),装入证书时出现“设备未准备好”错误。当使用X509证书发送http文章时,设备未准备好
该错误有点含糊,显然搜索是一些相当模糊的结果。有没有人遇到过这个?代码在Dim证书中断。...
证书已安装并可导出。感谢任何建议。
Dim SendPropertyUri As String = "http://post.url"
Dim request As HttpWebRequest
Dim byteData() As Byte
Dim postStream As Stream = Nothing
request = DirectCast(WebRequest.Create(SendPropertyUri), HttpWebRequest)
Dim certificate As New X509Certificate("D:\Processor\certificates\mycert.p12", "password")
request.ClientCertificates.Add(certificate)
request.Method = "POST"
request.ContentType = "application/xml"
request.Accept = "application/xml"
byteData = UTF8Encoding.UTF8.GetBytes(foo.OuterXml)
request.ContentLength = byteData.Length
postStream = request.GetRequestStream()
postStream.Write(byteData, 0, byteData.Length)
postStream.Close()