2014-09-08 2 views
2

"ws : //"URL을 사용할 때 내 XSockets.Net 코드가 제대로 작동하지만 보안 버전을 구현하려고 할 때 제대로 작동하지 않습니다. XSocket을 HTTPS 및 WSS와 함께 사용하려면 어떻게해야합니까?

나는 나의 가이드로 다음과 같은 C# 예제 코드를 사용 :

//Sample 1 - Certificate from store public class ChuckNorrisConfig : 
ConfigurationSetting { 
    public MyCustomConfig1() : base(new Uri("wss://my.server.ip.address:4502")) 
    { 
    this.CertificateLocation = StoreLocation.LocalMachine; 
    this.CertificateSubjectDistinguishedName = "cn=localmachine"; 
    } 
} 

//Sample 2 - X509Certificate2 
public class MyCustomConfig2 : ConfigurationSetting { 
public ChuckNorrisConfig() : base(new Uri("wss://my.server.ip.address:4502")) 
{ 
    this.Certificate = new X509Certificate2("file.name", "password");// line 369 
} 
} 

내가받을 다음과 같은 오류 : 나는 코멘트로 태그 한 라인 369에

ERROR 2014/09/07-19:50:16 Could not start XSockets server. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Security.Cryptography.CryptographicException: The system cannot find the file specifed.

at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) at System.Security.Cryptography.X509Certificates.X509Utils._QueryCertFileType(String fileName) at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags) at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password) at NET.Server.MyCustomConfig2..ctor() in C:\MyProjects\NET.Server\Program.cs:line 369 --- End of inner exception stack trace ---

그것은 오류가 밖으로 . "file.name"이 무엇을해야할지 모르겠습니다. SSL 인증서의 "file.name"을 얻으려면 어떻게해야합니까? 내가 만든 자체 서명 테스트 인증서를 사용하고 있지만 "file.name"을 가져올 곳을 모르겠습니다. 보고 싶지 않고 참조 할 수있는 실행 가능한 코드의 실제 예제가 있었으면 좋겠습니다. 일반 물건에.

XSocket WSS 구현에 대한 완전한 예제가 있습니까? XSockets.Net 버전 3.0.6을 사용하고 있습니다.

답변

0

기계에 인증서가 설치되어있는 경우 Sample1을 사용해야합니다 (사용자가 찾고있는 소리).

certmanager certmgr.msc를 사용하여 컴퓨터에서 인증서를 찾아 이름으로 찾을 수 있습니다.

샘플 1은 실제 파일 인증서가 있고 가져 오지 않으려는 경우입니다.

관련 문제