0

VB.NET 웹 응용 프로그램이 ISS7 서버에서 성공적으로 빌드되고 컴파일되지만 Visual Studio 2010을 통해 컴파일 할 때 로컬 시스템에서는 "System.Security.Cryptography"가 반환됩니다. CryptographicException : 지정된 파일을 찾을 수 없습니다. " 오류. 무슨 일이 일어나고 있는지 잘 모르지만 오류가 있습니다. Dim cert As New X509Certificate2(certFile, certFilePassword,X509KeyStorageFlags.MachineKeySet)웹 응용 프로그램은 iis7에서 작동하지만 로컬 컴퓨터에서는 작동하지 않습니다.

다음은 로컬 컴퓨터에 설치된 인증서를 사용하려고 시도하는 코드입니다. 내가 지금까지 시도 무엇

Sub LoginED(ByVal token As String) 
Try 
'We need the ED user ID 
lblEDUserID.Text = GetEDUserID().ToString() 

'Track user login 
InsertLogin(txtEDUsername.Text, True) 

'Set login cookies for ED users    
If lblEDUserID.Text = "0" Then 
lblEDLoginStatus.Text = "You have entered an incorrect login. Please try again." 
Else 

Dim certFile As String = "VIP_Cert.pfx" 
Dim certFilePassword As String = "password" 

Dim cert As New X509Certificate2(certFile, certFilePassword,X509KeyStorageFlags.MachineKeySet) 
Dim vipSoapInterfaceQueryServiceCert As New WebReference.QueryService 

'Dim fs As FileStream = File.Open(certFile, FileMode.Open, FileAccess.ReadWrite) 
'Dim filesize As Long = fs.Length 
'Dim buffer(filesize) As Byte 
'fs.Read(buffer, 0, filesize) 

'byte[] buffer = new byte[fs.Length]; 
'int count = fs.Read(buffer, 0, buffer.Length); 
'fs.Close() 

lblEDLoginStatus.Text = "Activation " 
vipSoapInterfaceQueryServiceCert.ClientCertificates.Add(cert) 

Dim vipSoapInterfaceService As New WebReference.GetCredentialInfoRequestType() 
vipSoapInterfaceService.credentialId = "SMR23324543" 
vipSoapInterfaceService.credentialType = WebReference.CredentialTypeEnum.STANDARD_OTP 
vipSoapInterfaceService.requestId = "ABCD" 

Dim vipSoapInterfaceResponse As New WebReference.GetCredentialInfoResponseType() 

vipSoapInterfaceResponse = vipSoapInterfaceQueryServiceCert.getCredentialInfo(vipSoapInterfaceService) 
lblEDLoginStatus.Text = "WebService Response: " + vipSoapInterfaceResponse.credentialId + ", Status:" + vipSoapInterfaceResponse.credentialStatus 

End If 
Finally 

: 1) 인증서 파일이 시스템에있을 경우의 전체 경로를 지정했습니다. .P12;

2)은 인증서 (.PFX의 다른 포맷을 시도 .CER)

3)는 판독 버퍼로부터 입력을 위해 버퍼에 전송 개방 인증을 시도했다. (System32 폴더에 .pfx 인증서 파일을 배치하고 코드가 인증서를 자동으로 인식 할 수 있기 때문에 IIS7에서 배포 할 때 버퍼 논리를 제거했지만 로컬에서 인식하지 못함)

4) "X509KeyStorageFlags .MachineKeySet "매개 변수. (IIS7 컴파일 용으로 사용)

어떤 도움을 주시면 감사하겠습니다!

+0

로컬 컴퓨터의 응용 프로그램 풀과 예외를 throw하는 서버 간의 차이점을 확인하는 것이 좋습니다. 허가 문제와 같은 냄새가납니다. –

답변

0

감사합니다. 나는 필요한 것을 알아낼 수 있었다. 인증서에 대한 응용 프로그램 풀을 만든 다음 해당 풀에 모든 권한을 제공해야합니다.

관련 문제