@Amin @04147834 @Ilan Prudhomme @Mike (Elcee) @Joshua Pries
I made a few changes that have now made all of mine succeed since. My issue was intermittent. It would randomly fail then succeed without any real pattern to go off of. I view this as a temporary fix until I find what the root cause is.
The (temp) fix was editing the web.config. When IIS checks if headers are complete, an exception is being thrown and the request is rejected. I personally needed to restart the server after changes were made
When a protocol violation occurs, a WebException exception is thrown with the status set to ServerProtocolViolation. If the UseUnsafeHeaderParsing property is set to true, validation errors are ignored.
-Microsoft
web.config:
<configuration>
<system.webServer>
<httpProtocol allowKeepAlive="false" />
</system.webServer>
</configuration>
<system.net>
<settings>
<servicePointManager expect100Continue="true"/>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
Once I find a permanent solution I will post it back here. When I have more time, I'll have to check my headers and report back here what exactly was causing the validation error. I am currently monitoring and I'll come back here to post if anymore failures occur and what my remedy is.
T-SQL query check for fails, returning your execution script so you can manually execute the failures (for those not familiar with SQL):
SELECT
CASE
WHEN s.[LastStatus] LIKE 'Failure sending mail%' THEN 0
WHEN s.[LastStatus] LIKE 'Mail Sent%' OR s.[LastStatus] LIKE 'Done%' THEN 1
END AS [Success],
'exec sp_start_job @job_name = ''' + cast(j.name as varchar(40)) + '''' AS [script],
s.[Description],
s.[LastStatus],
js.[last_run_duration],
js.[last_run_outcome],
js.[last_run_retries],
s.[LastRunTime]
FROM msdb.dbo.sysjobs j
LEFT JOIN msdb.dbo.sysjobsteps js ON js.job_id = j.job_id
LEFT JOIN [ReportServer].[dbo].[Subscriptions] s on js.command like '%' + cast(s.subscriptionid as varchar(40)) + '%'
WHERE [lastruntime] >= DATEADD(dd, -7, DATEDIFF(dd, 0, GETDATE()))
Here are the validations performed during HTTP parsing:
- In end-of-line code, use CRLF; using CR or LF alone is not allowed.
- Headers names should not have spaces in them.
- If multiple status lines exist, all additional status lines are treated as malformed header name/value pairs.
- The status line must have a status description, in addition to a status code.
- Header names cannot have non-ASCII chars in them. This validation is performed whether the HttpWebRequestElement.UseUnsafeHeaderParsing property is set to
true
or false
.
----------
Just in case it's related to anyone with a connection issue. I had previously also made a change for a connection issue by adding key values to the registry as per Microsoft's How to enable TLS 1.2 on clients documentation. This allows .NET to use the OS's TLS settings rather than attempting to use a disabled TLS 1.0 and failing
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727]
"SystemDefaultTlsVersions" = dword:00000001
"SchUseStrongCrypto" = dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions" = dword:00000001
"SchUseStrongCrypto" = dword:00000001