IT TIP

WCF 오류 "HTTP.SYS를 사용하여 HTTPS의 경우 서버 인증서가 제대로 구성되지 않았기 때문일 수 있습니다."

itqueen 2020. 11. 4. 21:04
반응형

WCF 오류 "HTTP.SYS를 사용하여 HTTPS의 경우 서버 인증서가 제대로 구성되지 않았기 때문일 수 있습니다."


Windows 서비스에서 웹 서버에서 실행중인 WCF 서비스로의 WCF 호출을 사용하는 데 문제가 있습니다. 이 통화는 몇 주 동안 작동했지만 갑자기 작동을 멈 췄고 그 이후로 작동하지 않았습니다.

내가 얻는 예외는 다음과 같습니다.

일반 오류 발생 System.ServiceModel.CommunicationException : HTTP 요청을 만드는 동안 오류가 발생했습니다.

그리고 그것은 말한다

이는 HTTPS의 경우 서버 인증서가 HTTP.SYS로 올바르게 구성되지 않았기 때문일 수 있습니다. 이는 클라이언트와 서버 간의 보안 바인딩 불일치로 인해 발생할 수도 있습니다.

내가 양쪽에서 사용하는 보안은 어떤 종류의 암호화도없이 wsHttpBinding입니다. 또한 HTTPS가 아닌 HTTP를 사용하고 있으므로 HTTPS에 대해 왜 불평하는지 모르겠습니다.

나머지 내부 예외 스택은 다음과 같습니다.

SystemNet.WebException : 기본 연결이 닫혔습니다. 전송시 예기치 않은 오류가 발생했습니다. ---> System.IO.IOException : 전송 연결에 데이터를 쓸 수 없습니다. 잘못된 인수가 제공되었습니다. ---> System.Net.Sockets.SocketException : System.Net.Sockets.Socket.MultipleSend (BufferOffsetSize [] buffers, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.MultipleWrite (BufferOffsetSize [])에 잘못된 인수가 제공되었습니다. 버퍼)

또한이 문제가 발생하는 내 프로그램의 지점은 웹 서비스 호출의 "실행"줄에 있습니다. 즉, 웹 서비스를 호출하고 래핑 된 DataContract 개체를 전달하는 즉시 폭파.

이 서비스가 수행하는 모든 작업은 많은 양의 XML (클라이언트 측 호출에 .NET 개체로 전달됨)을 전달한 다음 일부 작업을 수행하는 것입니다. 아마도 약 100-200k의 XML이 전송되고 있습니다. 양 끝의 데이터 크기에 대한 제한을 6 메가 이상으로 늘 렸지만 도움이되지 않는 것 같습니다.

어떤 아이디어?


이 문제에 대한 추가 정보 :

클라이언트 환경을 로컬로 복제 할 때 다음과 같이 변경하지 않으면 많은 양의 XML을 업로드 할 수 없습니다. 1. 서버에서 "maxRequestLength"를 100MB로 설정합니다 (보내는 것보다 훨씬 높음). 2. 켜기 클라이언트에서 dataContractSerializer 태그 아래의 maxItemsInObjectGraph 값을 "2147483646"으로 설정했습니다.

이러한 변경으로 로컬 설치가 성공적으로 업로드됩니다. 그러나 클라이언트의 서버 설치는 여전히 실패합니다. 흥미로운 점은 서버에서 maxRequestLength 값을 변경 한 후 테스트 설치에서 특히 maxItemsInObjectGraph 설정과 관련된 오류가 발생하기 시작했다는 것입니다. 클라이언트 서버에서는 여전히 원래 "HTTP.sys"오류가 발생합니다.

앞서 언급했듯이 우리는 SSL을 전혀 사용하지 않으며 동일한 방식으로 XML을 실행하고 업로드하는 두 가지 다른 웹 서비스 호출이 있습니다. 그러나 작동하지 않는 서비스 호출이 더 많은 데이터를 전송하기 때문에 이는 크기 문제로 보입니다.

그러나 클라이언트가 가진 문제가 테스트 설치와 동일한 문제인 경우 클라이언트 오류 메시지가 ObjectGraph 오류와 관련이없는 이유를 알 수 없습니다.

클라이언트에서 가능한 모든 오류에 대해 일반적인 "유효하지 않은 매개 변수" "HTTP.sys"오류가 발생하는 것이 가능합니까 (즉, 실제로 objectGraph 오류도 발생하지만 표시되지 않습니까?)


호스트 서버가 TLS V1.2를 사용하도록 업데이트되었고 표준 SSL을 사용하여 연결했기 때문에이 문제가 발생했습니다. 이것은 사이트의 펜 테스트의 일부로 만들어진 업데이트입니다. 우리는 코드 연결에서 문제를 보았지만 wsdl로가는 브라우저는 보지 못했습니다. 아래 코드가 해결되었습니다.

if (System.Net.ServicePointManager.SecurityProtocol == (SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls))
    System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

출처 : SSL 폴백을 비활성화하고 .NET에서 아웃 바운드 연결에 TLS 만 사용하려면 어떻게해야합니까? (푸들 완화)


IIS 7에서 실행되는 서비스에서 동일한 문제가 발생하여 서비스가 여러 공급 업체 서버 (일부는 SSL이 아님)에 새 서버를 추가 할 때 (일부는 SSL이 아님) 연결됩니다 (이 새로운 공급 업체는 TLS 1.2 임). 몇 번의 요청 후 오류가 발생했습니다. 원래 서버 (SSL)로 만들어졌습니다.

이를 확인 System.Net.ServicePointManager.SecurityProtocol하기 위해 각 공급 업체에 요청하기 전에 간단히 기록했습니다 .

낮고 서비스를 다시 시작한 후 (또는 응용 프로그램 풀을 다시 시작한 후) 보라. 출력을 얻을 수 Ssl3, Tls있지만 원래 공급자 서버에 대한 몇 가지 요청 후에 이것이 변경되고 Ssl3TLS 서비스에 대한 요청으로 오류가 발생했습니다.

수정하기 위해 user369142가 제안한 것을 간단히 수행했습니다. 새 서버에 대한 각 요청 전 :

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;

더 이상 오류가 없습니다.


이 문제가 실제 HTTPS 바인딩과 "HTTP.SYS의 HTTPS 케이스에서 서버 인증서가 제대로 구성되지 않았기 때문일 수 있습니다."와 동일한 예외가 발생했습니다. 코드 및 구성의 모든 것을 다시 확인한 후 오류 메시지가 내부 예외만큼 오해의 소지가없는 것처럼 보이므로 빠른 확인 후 포트 443이 (개발 서버에서) skype에 의해 연결되었음을 발견했습니다. 요청을 보류하는 항목 (Fiddler가 여기에서 도움이 될 수 있음)을 살펴보고 서비스 전면 (브라우저에서 .svc보기) 및 해당 메타 데이터에 도달 할 수 있는지 확인하는 것이 좋습니다.

행운을 빕니다.


제 경우에는 SchUseStrongCrypto.Net 을 활성화해야했습니다. 이렇게하면 서버가 TLS 1.0, 1.1 또는 1.2를 사용하여 연결해야합니다. 없이 SchUseStrongCrypto사용 가능 연결이 내 원격 엔드 포인트에서 비활성화되었습니다 사용 SSL 3.0에 노력했다.

강력한 암호화를 사용하기위한 레지스트리 키 :

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

우리에게이 오류는 서비스를 실행하는 개발자의 컴퓨터에 127.0.0.1에서만 포트 443을 바인딩하도록 IIS가 구성되어 있기 때문입니다.

IIS 관리자에서 웹 사이트를 마우스 오른쪽 단추로 클릭하고 바인딩 편집을 선택합니다. 포트 항목에 443IP 주소가 있으면로 127.0.0.1변경합니다 *.


많은 검색과 영주의 이름을 헛되이 취한 후 마침내 얻었습니다. 내 wcf 서비스가 실행되는 서버에 TLS 1.2를 설치했습니다. 내 클라이언트는 올바르게 구성되었지만 .NET 4.5.1에서 빌드되었지만 wcf는 .NET 4.6.1에있었습니다. TLS 1.2를 사용하는 경우 클라이언트와 서버는 모두 동일한 .NET 버전이어야합니다. 언젠가 누군가에게 도움이되기를 바랍니다.


클라이언트 애플리케이션을 4.5 이상으로 변경하십시오. 4.5 인 경우 다음을 사용하십시오. System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12 / Tls1.1 / Tls1.0 필요에 따라 응용 프로그램을 4.6.1 이상으로 업그레이드 할 수 있습니다.


최근에 거의 동일한 문제가 발생 했으며 호출 컴퓨터에 설치된 Microsoft 업데이트 KB980436 ( http://support.microsoft.com/KB/980436 )으로 인해 발생한 것으로 밝혀졌습니다 . 완전히 제거하는 것 외에 우리를위한 해결책은 KB 사이트의 지침에 따라 레지스트리의 UseScsvForTls DWORD를 1로 설정하는 것이 었습니다.이 업데이트가 호출 시스템에 설치되어있는 것을 확인하면 시도해 볼 수 있습니다. .


I had this issue when running older XP SP3 boxes against both IIS and glassfish on Amazon AWS. Amazon changed their default load balancer settings to NOT enable the DES-CBC3-SHA cipher. You have to enable that on amazon ELB if you want to allow older XP TLS 1.0 to work against ELB for HTTPS otherwise you get this error. Ciphers can be changed on ELB by going to the listener tab in the console and clicking on cipher next to the particular listener you are trying to make work.


If your WCF service is using .net framework 4.0 and someone has disabled TLS 1.0 on the server then you will see this exception. Due to .net 4.0 not supporting the higher versions of TLS.

Supported protocols: https://msdn.microsoft.com/en-us/library/system.security.authentication.sslprotocols(v=vs.100).aspx


I've seen these particular exceptions related to Complex DataType issues, see the following post if you're passing around collections or enums:

Complex Data Types


If you are using transfer mode = streamed, try changing it to buffered.

If this is not the problem could you post your configuration.


Since everything was working fine for weeks then stopped, I doubt this has anything to do with your code. Perhaps the error is occurring when the service is activated within IIS/ASP.NET, not when your code is called. The runtime could just be checking the configuration of the web site and throwing a generic error message which has nothing to do with the service.

My suspicion is that a certificate has expired or that the bindings are set up incorrectly. If the web site is mis-configured for HTTPS, whether your code uses them or not, you may be getting this error.


Try to browse the service in the browser and in the Https mode, if it is not brow-sable then it proves the reason for this error. Now, to solve this error you need to check :

  • https port , check if it is not being used by some other resources (website)
  • Check if certificate for https are properly configured or not (check signing authority, self signed certificate, using multiple certificate )
  • check WCF service binding and configuration for Https mode

Our issue was simply the port number on the endpoint was incorrectly set to 8080. Changed it to 8443 and it worked.


Just recently experienced this:

System.ServiceModel.CommunicationException:

An error occurred while making the HTTP request to http://example.com/WebServices/SomeService.svc. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.

---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send.

---> System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.

I found out from an administrator that the IIS application pool that was hosting the web service recycled automatically after running out of memory. The error on the client occurred when the application pool recycled.

Increasing the memory available to the application pool resolved the immediate issue.


Our applications were recently forced off of SSL to TLS via a network appliance (F5) OS update. We fixed this error by re-generating the self-signed certs. Hope this helps someone in the future to resolve the issue as we spent multiple maintenance windows troubleshooting before arriving at the solution.


Just recently experienced this:

System.ServiceModel.CommunicationException:

An error occurred while making the HTTP request to http://example.com/WebServices/SomeService.svc. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.

---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send.

---> System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.

Our license of the bluecoat proxy was expired! so it was not possible to to reach the external party (internet).


We had the same issue and, in our case, it was resolved by reinstalling the certificate and creating the binding again. What lead us there was the fact that even getting a simple png image file on the site give the same error.

참고URL : https://stackoverflow.com/questions/2013880/wcf-error-this-could-be-due-to-the-fact-that-the-server-certificate-is-not-conf

반응형