1

Closed

URL Check logs exceptions w/ Accept header

description

I set up an URL check for some of my sites, saved it and restarted Wolfpack. The service logged an exception for the "Accept" header as follows:
2014-07-24 11:37:02,937 [       11] ERROR                  Wolfpack - Wolfpack Component Failure. IncidentId:=1c5389ec-bd9e-41d8-a243-92463de56db6; Name:=grossweber.com Web; Details:=System.ArgumentException: The 'Accept' header must be modified using the appropriate property or method.
Parameter name: name
   at System.Net.WebHeaderCollection.ThrowOnRestrictedHeader(String headerName)
   at System.Net.WebHeaderCollection.Add(String name, String value)
   at Wolfpack.Core.Checks.UrlPingCheck.<Execute>b__2(String url) in c:\Projects\Wolfpack\Releases\v3.0.25\Source\Wolfpack.Core\Checks\UrlPingCheck.cs:line 154
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Wolfpack.Core.Checks.UrlPingCheck.Execute() in c:\Projects\Wolfpack\Releases\v3.0.25\Source\Wolfpack.Core\Checks\UrlPingCheck.cs:line 136
   at Wolfpack.Core.Schedulers.HealthCheckIntervalScheduler.Execute() in c:\Projects\Wolfpack\Releases\v3.0.25\Source\Wolfpack.Core\Schedulers\HealthCheckIntervalScheduler.cs:line 55
Here's the config (I didn't touch the headers part):
{
  "Name": "grossweber.com Web",
  "Description": "This check will ping a set of urls (including data apis; use Headers property to control Accept type) and raise notifications if the ping fails or is too slow. You can control the failure threshold using the 'NotificationThreshold' property of the configuration; set it to the number of milliseconds that the endpoint must respond by.",
  "InterfaceType": null,
  "PluginType": "Wolfpack.Core.Checks.UrlPingCheck, Wolfpack.Core",
  "ConfigurationType": "Wolfpack.Core.Checks.UrlPingCheckConfig, Wolfpack.Core",
  "Data": "{\"ContentRegex\":\"GROSSWEBER\",\"IsAjaxCall\":false,\"UseDefaultCredentials\":false,\"Urls\":[\"http://grossweber.com\"],\"UserAgentString\":\"\",\"Headers\":{\"Accept\":\"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\"},\"PostData\":\"\",\"NotificationThreshold\":5000,\"NotificationMode\":\"StateChange\",\"FriendlyId\":\"grossweber.com Web\",\"Enabled\":true}",
  "Tags": [
    "HealthCheck",
    "Url",
    "Ping",
    "Threshold"
  ],
  "Link": null,
  "RequiredProperties": {
    "Name": "grossweber.com Web",
    "Scheduler": "EveryMinute"
  }
}
Closed Aug 1 at 3:07 PM by jimbobdog

comments

jimbobdog wrote Jul 24 at 11:45 AM

Ok thanks for letting me know, will take a look

jimbobdog wrote Jul 24 at 12:15 PM

If you remove the Accept header (added by default to demonstrate a non-html request) it should work.

The problem is that certain headers are protected and must be set via dedicated methods (http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.headers.aspx, I will fix tonight).

HTH

jimbobdog wrote Jul 24 at 1:30 PM

Fix now in source control - will release binaries later today

J

AlexanderGross wrote Jul 24 at 2:27 PM

Thanks!