I have a question.
When some calls my webservice this is logged to the IIS log file and I also log the request (after is has been processed) to a custom log file for statistics purposes.
I use the following function to log to file:
Public Sub Log(ByVal Message As String, ByVal Level As LogEntryLevel, ByVal Additional As Boolean)
Dim base As String = "C:\SERVER\log\"
Dim fileName As String = Date.Now.ToString("dd-MM-yyyy") & ".log"
Dim newString As String = ""
If Not Additional Then
If System.IO.File.Exists(base + fileName) Then newString &= vbNewLine
newString &= Date.Now.ToString("[dd/MM/yyyy HH:mm:ss.fff ") & Level.ToString & "] " & Message
Else
newString &= Message
End If
My.Computer.FileSystem.WriteAllText(base + fileName, newString, True)
End Sub
I use the following function to get the clients IP-address:
Public Function getIP() As String
Dim ip As String
ip = Context.Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If ip = String.Empty Then
ip = Context.Request.ServerVariables("REMOTE_ADDR")
End If
Return ip
End Function
Yesterday, at 4 PM this got logged:
[18-03-2012 16:08:20.282 INFO] Client 192.168.1.1 invoked CheckForUpdate with []
[18-03-2012 16:08:20.485 SEVERE] FATAL EXCEPTION WHILE PROCESSING REQUEST:
IP : 192.168.1.1
Source : mscorlib
Method : Parse
Type : System.ArgumentNullException
Error Message : Waarde kan niet null zijn.
Parameternaam: input
Stack Trace : bij System.Version.Parse(String input)
bij System.Version..ctor(String version)
bij DataLayer.Service.CheckForUpdate(String ver) in File1:regel 79
-------------------------END ERROR REPORT-------------------------
[18-03-2012 16:08:20.516 INFO] Client 192.168.1.1 invoked CheckForUpdate with []
[18-03-2012 16:11:01.165 INFO] Client 192.168.1.1 invoked CheckForUpdate with []
[18-03-2012 16:11:01.165 SEVERE] FATAL EXCEPTION WHILE PROCESSING REQUEST:
IP : 192.168.1.1
Source : mscorlib
Method : Parse
Type : System.ArgumentNullException
Error Message : Waarde kan niet null zijn.
Parameternaam: input
Stack Trace : bij System.Version.Parse(String input)
bij System.Version..ctor(String version)
bij DataLayer.Service.CheckForUpdate(String ver) in File1:regel 79
-------------------------END ERROR REPORT-------------------------
[18-03-2012 16:11:01.165 INFO] Client 192.168.1.1 invoked CheckForUpdate with []
Yet, the IIS logs are completely empty around that time:
#Software: Microsoft Internet Information Services 7.5
#Version: 1.0
#Date: 2012-03-18 15:33:33
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User- Agent) sc-status sc-substatus sc-win32-status time-taken
2012-03-18 15:33:33 192.168.1.250 POST /Service.asmx - 80 - x.252.x.210 - 200 0 0 2761
2012-03-18 15:34:05 192.168.1.250 POST /Service.asmx - 80 - x.180.x.226 - 200 0 0 358
2012-03-18 15:39:29 192.168.1.250 POST /Service.asmx - 80 - x.166.x.235 - 200 0 0 390
2012-03-18 15:39:57 192.168.1.250 POST /Service.asmx - 80 - x.18.x.149 - 200 0 0 405
2012-03-18 15:44:20 192.168.1.250 POST /Service.asmx - 80 - x.4.x.113 - 200 0 0 343
2012-03-18 15:44:45 192.168.1.250 GET /Rejected-By-UrlScan ~/ 80 - x.192.x.18 - 404 0 64 218
2012-03-18 15:49:34 192.168.1.250 POST /Service.asmx - 80 - x.219.x.45 - 200 0 0 374
2012-03-18 15:52:52 192.168.1.250 POST /Service.asmx - 80 - x.59.x.202 - 200 0 0 312
2012-03-18 16:04:22 192.168.1.250 POST /Service.asmx - 80 - x.59.x.202 - 200 0 0 312
#Software: Microsoft Internet Information Services 7.5
#Version: 1.0
#Date: 2012-03-18 16:29:02
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User- Agent) sc-status sc-substatus sc-win32-status time-taken
2012-03-18 16:29:02 192.168.1.250 POST /Service.asmx - 80 - x.170.x.194 - 200 0 0 1310
2012-03-18 16:37:54 192.168.1.250 POST /Service.asmx - 80 - x.222.x.11 - 200 0 0 343
2012-03-18 16:39:09 192.168.1.250 POST /Service.asmx - 80 - x.243.x.193 - 200 0 0 327
2012-03-18 16:53:31 192.168.1.250 POST /Service.asmx - 80 - x.131.x.104 - 200 0 0 249
How is it possible that the IIS logs are empty and yet my application logged something from the local network? At the time, no at on my LAN sent that request. No one was home and we don’t have a wireless network. Did I have an unauthorised intrusion?
It would be awesome if you guys cound answer my question for me!
Greetings.
Based on the log files, it looks like IIS could have been reset around that time (could have been a system reboot, someone doing iisreset, application pool regularly recylcing, etc).
The most likely explanation is that you have code within your DataLayer that is executed on startup of IIS that calls the
CheckForUpdatemethod, which is why there is nothing in the IIS log.