2015-04-02 66 views
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() 

回答

0

經過一番研究,通過安裝IIS6兼容性組件解決了這個問題。不確定究竟是什麼導致了這個問題,但安裝IIS6管理控制檯後,它沒有問題。

只是回答錯誤是一個模糊的錯誤,所以可能會幫助別人或給他們一個起點。