2013-08-26 3 views
29

자체 호스팅 웹 API 서비스를 만들고 있습니다. 고정하기 위해, 내가 공부하고 this 기사를 구현했습니다, 성공적으로 인증 지역 SSL makecert를 사용하여 인증서 및 내 서비스를 생성하고 내가ASP.NET 자체 호스팅 웹 API에서 SSL 구성

http://localhost/webapi/authentication/authenticate 

링크를 사용하고있는 경우, 토큰 잘 생성,하지만 난에 액세스하려고 할 때 HTTPS를 사용하여 내 서비스는 파이어 폭스에서 다음을 얻을 :

와 같은 요청에 대해 피들러가 나를 보여줍니다

SSL_ERROR_RX_RECORD_TOO_LONG :

HTTP/1.1 502 Fiddler - 연결 실패 날짜 : 2012 년 8 월 26 일 월요일 10:44:27 GMT Content-Type : text/html; charset = UTF-8 연결 : 닫기 타임 스탬프 : 13 : 44 : 27.433

[Fiddler] localhost에 대한 소켓 연결이 실패했습니다.
에 실패했습니다. server.fiddler.network.https와 HTTPS 연결을 협상합니다. > localhost에 대한 기존 연결을 보호하지 못했습니다. this post에서 촬영 ExtendedHttpSelfHostConfiguration이

private HttpSelfHostServer _server; 
    private ExtendedHttpsSelfHostConfiguration _config; 
    public const string ServiceAddress = "https://localhost/webapi"; 
    _config = new ExtendedHttpsSelfHostConfiguration(ServiceAddress); 
    _server = new HttpSelfHostServer(_config); 
    _server.OpenAsync(); 

입니다

: 나는

public class ExtendedHttpSelfHostConfiguration : HttpSelfHostConfiguration 
{ 
    public ExtendedHttpSelfHostConfiguration(string baseAddress) : base(baseAddress) { } 
    public ExtendedHttpSelfHostConfiguration(Uri baseAddress) : base(baseAddress) { } 

    protected override BindingParameterCollection OnConfigureBinding(HttpBinding httpBinding) 
    { 
     if (BaseAddress.ToString().ToLower().Contains("https://")) 
     { 
      httpBinding.Security.Mode = HttpBindingSecurityMode.Transport; 
     } 

     return base.OnConfigureBinding(httpBinding); 
    } 
} 

를 누락 무엇 핸드 쉐이크 는

내 자기 호스트 구성 .. 예기치 않은 패킷 형식으로 인해 실패 ? 미리 감사드립니다.

+0

어쩌면 때문에 http://stackoverflow.com/questions/18442542/ssl-error-rx-record-to-long-on-self-hosted-asp-net-web-api? – I4V

+2

나만의 링크 ** 삭제 ** 게시물 .. –

+0

더 많은 매력을 얻으려면 ** 같은 **을 물어보고 이전 것을 삭제하십시오. – I4V

답변

27

this blog post에 따르면 SSL 인증서를 만들어 특정 포트 (내 경우에는 99)에 지정해야한다는 것을 알았습니다.

로컬로 서명 한 SSL을 만들었습니다. 그런 다음 지문이ApplicationId입니다. CMD 명령을 사용하여 netsh를, 나는 포트

netsh http add sslcert ipport=0.0.0.0:99 certhash=3e49906c01a774c888231e5092077d3d855a6861 appid={2d6059b2-cccb-4a83-ae08-8ce209c2c5c1}, certhash = SSL 지문 및 APPID = 애플리케이션 ID 나는 내 인증서를 할당했습니다 (전 Win7에 시스템에 하면 Httpcfg 도구가있다) 더 일찍 복사 했어.

이제 HTTPS 요청을 할 수 있습니다.

+28

여기에 좋은 질문이 있지만 유용한 답변이 있지만 그 가치는 거의 전적으로 링크에 달려 있습니다 외부 자원에. 답변을 편집하고이 작업을 수행하기 위해 취한 웹 API 관련 단계 목록을 추가 할 수 있습니다. 이것은 하이퍼 링크가 "썩어"는 경우에 다른 사람들에게 당신의 대답의 가치를 향상시킵니다. – dasblinkenlight

관련 문제