1

I'm troubleshooting a batch file that uses Wget to send requests to a website running in IIS 7. The batch file runs Wget twice, the first time to login to the site via a POST, the second to run some maintenance code in the site via a GET. The server running the batch file and the server hosting the site are on the same private network.

The first POST request is logged in the IIS site log. According to the output of Wget, it appears to be making several attempts for the second GET request – 20 in total (usually) – but none of them are being logged.

The (edited) contents of the problematic batch file:

wget --output-document=- --save-cookies cookies.txt --keep-session-cookies --post-data "UserName=user@example.com&Password=not-the-best-password&RememberMe=false" --no-check-certificate https://example.com/account/logon?returnurl=/

wget --output-document=- --load-cookies cookies.txt --no-check-certificate https://example.com/things/stuff/maintenance-code?x=E74B15D4-414E-468C-A340-621CC901CF1B

An (edited) example of the Wget (standard error) output for the first two attempts for the second GET request from the latest execution of the batch file:

SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
--2013-04-19 05:15:16--  https://example.com/things/stuff/maintenance-code?x=E74B15D4-414E-468C-A340-621CC901CF1B
Resolving example.com... 172.17.21.255
Connecting to example.com|172.17.21.255|:443... connected.
WARNING: cannot verify example.com's certificate, issued by `blah-blah-blah':
  Self-signed certificate encountered.
HTTP request sent, awaiting response... Read error (No such file or directory) in headers.
Retrying.

--2013-04-19 05:20:21--  (try: 2)  https://example.com/things/stuff/maintenance-code?x=E74B15D4-414E-468C-A340-621CC901CF1B
Connecting to example.com|172.17.21.255|:443... connected.
WARNING: cannot verify example.com's certificate, issued by `blah-blah-blah':
  Self-signed certificate encountered.
HTTP request sent, awaiting response... Read error (No such file or directory) in headers.
Retrying.

There is another batch file that also uses Wget and also runs it twice, the first time to login exactly as the other batch file does, and the second time to run some other maintenance code in the site and also via a GET, and both the POST and GET requests are logged in IIS. An edited example of the Wget (standard error) output for the GET request for the latest execution of this batch file:

SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
--2013-04-19 06:58:50--  https://example.com/things/other-stuff/other-maintenance-code
Resolving example.com... 172.17.21.255
Connecting to example.com|172.17.21.255|:443... connected.
WARNING: cannot verify example.com's certificate, issued by `blah-blah-blah':
  Self-signed certificate encountered.
HTTP request sent, awaiting response... 200 OK
Length: 15 [application/json]
Saving to: `STDOUT'

     0K                                                       100% 2.05M=0s

2013-04-19 06:59:06 (2.05 MB/s) - `-' saved [15/15]
1

One possible answer is that the requests aren't being logged because IIS hasn't received a response from the site. Based on this answer to the existing question When does IIS log a request?, this would definitely be the case.

Maybe the Wget settings are such that Wget gives-up waiting for a response after five (5) minutes instead of 15 (which is the default setting according to the Wget documentation).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.