How to capture the network communication details b/w Application & client

2017-01-15

Sometimes one might need to know what is occurring at network level even before the user request reaches the application level. For instance if you are receiving only an exception at application level such as like this:
Exception is : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. Source is : System Stack trace is : at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream()

And at n/w team at both parties says everthing is normal i.e. at the reciving server(here it's our server) & sending server(here customer's server).

To know exactly what is causing this exception, we will get more details about this kind of exceptions by enabling n/w trace. This can be done at the App.config file of the AppServer. You will find the details of n/w communication in the path you mentioned in the App.config, here: c:\network.log​



    
      
        
          
           
      
        
          
        
      
        
          
        
    
    
      
      
      
    
    
      
    
    
  

In the end, by looking at the captured log it seems to be that the certificate of the customer was not accepted by the application server. I could find this information in the trace log:


System.Net.Sockets Verbose: 0 : [0940] 00000010 : AE AE DA C7 BF 8B 75 D5-5B EA 88 2E 73 9A 5C 10 : ......u.[...s.\.
System.Net.Sockets Verbose: 0 : [0940] 00000020 : 76 EF 5A C7 DC 86 78 CF-C6 88 36 F0 5C 95 E0 B9 : v.Z...x...6.\...
System.Net.Sockets Verbose: 0 : [0940] 00000030 : 57 06 03 43 A0 51 7A 38-D1 AA 9A E1 B9 62 E3 4F : W..C.Qz8.....b.O
System.Net.Sockets Verbose: 0 : [0940] 00000040 : 63 0A 31 DE 47 6F 81 0C-40 AB EA B4 3F 55 09 6B : c.1.Go..@...?U.k
System.Net.Sockets Verbose: 0 : [0940] 00000050 : 79 07 C8 FE D0 DD 53 61-35 14 D2 76 D4 24 C0 95 : y.....Sa5..v.$..
System.Net.Sockets Verbose: 0 : [0940] 00000060 : 1A 79 CA 59 3F EB C7 06-FE 72 00 15 E3 AB F2 E7 : .y.Y?....r......
System.Net.Sockets Verbose: 0 : [0940] 00000070 : 1E 10 5C AB 64 3D 6C FC-33 76 7A 06 61 45 9C 27 : ..\.d=l.3vz.aE.'
System.Net.Sockets Verbose: 0 : [0940] 00000080 : D2 44 18 F5 41 9B E9 BE-86 EF 15 7D E4 45 1C 8A : .D..A......}.E..
System.Net.Sockets Verbose: 0 : [0940] 00000090 : 38 30 8F 56 74 F2 E9 ED-7C 9E AB 1D 0D 03 F1 1B : 80.Vt...|.......
System.Net.Sockets Verbose: 0 : [0940] 000000A0 : 3A ED B4 DF 42 7C AF E6-21 66 B2 4E CA 7B 59 3E : :...B|..!f.N.{Y>
System.Net.Sockets Verbose: 0 : [0940] 000000B0 : 3B 8C D8 66 2A 0C BD 9C-18 DE 7A 42 D2 6B E7 C6 : ;..f*.....zB.k..
System.Net.Sockets Verbose: 0 : [0940] 000000C0 : C1 E7 6D 6E 2E E6 A6 E2-78 3C FD 58 3F 9F F3 23 : ..mn....x<.X?..#
System.Net.Sockets Verbose: 0 : [0940] 000000D0 : 5E CC 66 52 1F 9A EC B1-85 91 C0 A7 34 E8 F0 DC : ^.fR........4...
System.Net.Sockets Verbose: 0 : [0940] 000000E0 : 7D 86 2D C5 DF A2 9C BE-69 35 74 52 76 4D C1 44 : }.-.....i5tRvM.D
System.Net.Sockets Verbose: 0 : [0940] 000000F0 : 3E 3B 83 9F 8D 2F 3B C6-B2 A8 7F 42 CD BD 22 4A : >;.../;....B.."J
System.Net.Sockets Verbose: 0 : [0940] 00000100 : AF 5E 01 33 D0 19 FF 54-98 81 52 14 03 01 00 01 : .^.3...T..R.....
System.Net.Sockets Verbose: 0 : [0940] 00000110 : 01 16 03 01 00 20 07 F4-8E BA 46 DD 38 EF 25 16 : ..... ....F.8.%.
System.Net.Sockets Verbose: 0 : [0940] 00000120 : 88 77 4D 96 84 89 D8 33-F0 94 D1 89 81 C0 6F B1 : .wM....3......o.
System.Net.Sockets Verbose: 0 : [0940] 00000130 : FF FE 51 3F D4 85                               : ..Q?..
System.Net.Sockets Verbose: 0 : [0940] Exiting Socket#10261382::Send()  -> 310#310
System.Net.Sockets Verbose: 0 : [0940] Socket#10261382::Receive()
System.Net.Sockets Verbose: 0 : [0940] Data from Socket#10261382::Receive
System.Net.Sockets Verbose: 0 : [0940] 00000000 : 14 03 01 00 01                                  : .....
System.Net.Sockets Verbose: 0 : [0940] Exiting Socket#10261382::Receive()  -> 5#5
System.Net.Sockets Verbose: 0 : [0940] Socket#10261382::Receive()
System.Net.Sockets Verbose: 0 : [0940] Data from Socket#10261382::Receive
System.Net.Sockets Verbose: 0 : [0940] 00000005 : 01                                              : .
System.Net.Sockets Verbose: 0 : [0940] Exiting Socket#10261382::Receive()  -> 1#1
System.Net Information: 0 : [0940] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = 1a83060:4f01a90, targetName = 208.65.59.102, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [0940] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=ContinueNeeded).
System.Net.Sockets Verbose: 0 : [0940] Socket#10261382::Receive()
System.Net.Sockets Verbose: 0 : [0940] Data from Socket#10261382::Receive
System.Net.Sockets Verbose: 0 : [0940] 00000000 : 16 03 01 00 20                                  : .... 
System.Net.Sockets Verbose: 0 : [0940] Exiting Socket#10261382::Receive()  -> 5#5
System.Net.Sockets Verbose: 0 : [0940] Socket#10261382::Receive()
System.Net.Sockets Verbose: 0 : [0940] Data from Socket#10261382::Receive
System.Net.Sockets Verbose: 0 : [0940] 00000005 : 2F F4 5F 34 94 31 43 6B-E8 9E DF 73 F2 38 40 11 : /._4.1Ck...s.8@.
System.Net.Sockets Verbose: 0 : [0940] 00000015 : 0B CD EB 74 FF 79 3E E9-09 FC 70 40 1E EA 5F 86 : ...t.y>...p@.._.
System.Net.Sockets Verbose: 0 : [0940] Exiting Socket#10261382::Receive()  -> 32#32
System.Net Information: 0 : [0940] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = 1a83060:4f01a90, targetName = 208.65.59.102, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [0940] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=OK).
System.Net Information: 0 : [0940] Remote certificate: [Version]
  V3

[Subject]
  CN=*.loewshotels.com, O=LOEWS HOTELS HOLDING CORPORATION, L=New York, S=New York, C=US
  Simple Name: *.loewshotels.com
  DNS Name: loewshotels.com

[Issuer]
  CN=GeoTrust SSL CA - G3, O=GeoTrust Inc., C=US
  Simple Name: GeoTrust SSL CA - G3
  DNS Name: GeoTrust SSL CA - G3

[Serial Number]
  6FE9FB525426DDBB0A93A92A3C1E92AB

[Not Before]
  10/1/2015 12:00:00 AM

[Not After]
  9/30/2016 11:59:59 PM

[Thumbprint]
  72D2C02328C86D8CFC95A0BA8ADA9D441E52D9AD

[Signature Algorithm]
  sha256RSA(1.2.840.113549.1.1.11)

[Public Key]
  Algorithm: RSA
  Length: 2048
  Key Blob: 30 82 01 0a 02 82 01 01 00 ea 70 dd ae 1d df 72 35 54 60 22 ee 31 37 49 b9 3a 5d f3 69 9e 60 d0 4a 24 3d e7 62 47 ce 93 af 1e 92 63 03 eb 2e 64 2a a2 01 c5 c1 14 17 44 1e 31 01 45 3e 95 57 d1 0d b4 9b 2d ad 7a 1b 60 1c 8a 77 e9 c9 69 fa ce f1 1d 39 be 57 5c 19 02 19 13 ed 58 56 15 fa 91 f5 99 75 43 3f cf 61 ed 2f ab d6 7b bf 37 8b 31 2f 8a 13 a8 7b b0 65 35 b2 ce f7 b8 ee 7d fc 39 85....
System.Net Information: 0 : [0940] SecureChannel#17043416 - Remote certificate has errors:
System.Net Information: 0 : [0940] SecureChannel#17043416 -  Certificate name mismatch.
System.Net Information: 0 : [0940] SecureChannel#17043416 - Remote certificate was verified as invalid by the user.
System.Net.Sockets Verbose: 0 : [0940] Socket#10261382::Dispose()
System.Net Error: 0 : [0940] Exception in the HttpWebRequest#44419000:: - The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
System.Net Error: 0 : [0940] Exception in the HttpWebRequest#44419000::EndGetRequestStream - The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

0 comments: