I'm trying to setup the transform manager notification service following the guide located here:
http://learn.iis.net/page.aspx/1031/sending-transform-manager-job-status-notifications-to-a-remote-web-application/
I have an asp.net website up and running with a page post.aspx in the root directory. For testing purposes I am writing the results to a local file.
If I run an http post tester with the message being posted shown below in the post message my results are written to the file with no issues.
However if Transform Manager tries to send the notification I receive the following error in windows event log:
The thread posting the notification message to http://localhost/post.aspx failed: The remote server returned an error: (500) Internal Server Error.. Message being posted :
Imports System.IO
PartialClasstest_postInherits System.Web.UI.PageProtectedSub Page_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Load
'Get the XML data from the requestDim bArr AsByte() = Me.Request.BinaryRead(Me.Request.TotalBytes)
Dim content AsString = System.Text.Encoding.UTF8.GetString(bArr, 0, bArr.Length)
' if the content existsIfNot content IsNothingThen' create new notification modelDim notification AsNotificationModel = NewNotificationModel()
' Parse the XML to an instance object and insert it into the databaseIfNotificationModel.TryParse(content, notification) Then
notification.PostedDateTime = DateTime.Now.ToString()
Dim filename AsString = Server.MapPath("~/test/post.txt")
'Get a StreamWriter class that can be used to write to the fileDim objStreamWriter AsStreamWriter
objStreamWriter = File.AppendText(filename)
objStreamWriter.WriteLine(notification.PostedDateTime)
objStreamWriter.WriteLine(notification.JobName)
objStreamWriter.WriteLine(notification.PostedDateTime)
objStreamWriter.WriteLine(notification.Queue)
objStreamWriter.WriteLine(notification.Log)
objStreamWriter.WriteLine(notification.Folder)
objStreamWriter.WriteLine(notification.JobDefinitionId)
objStreamWriter.WriteLine(notification.JobTemplateId)
objStreamWriter.WriteLine(notification.JobSchedulerId)
objStreamWriter.WriteLine(notification.ManifestName)
objStreamWriter.WriteLine(notification.InstanceFileName)
objStreamWriter.WriteLine(notification.QueueTime)
objStreamWriter.WriteLine(notification.Progress)
objStreamWriter.WriteLine(notification.SubmitTime)
objStreamWriter.WriteLine(notification.StartTime)
objStreamWriter.WriteLine(notification.EndTime)
objStreamWriter.WriteLine(notification.Priority)
objStreamWriter.WriteLine(notification.Status)
objStreamWriter.WriteLine(notification.TaskCount)
objStreamWriter.WriteLine(notification.TaskIndex)
'Close the stream
objStreamWriter.Close()
EndIfEndIfEndSubEndClass''' <summary>''' </summary>''' <remarks></remarks>PublicClassNotificationModel#Region"Public Properties"''' <summary>''' This is the time the notification was posted to the server''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty PostedDateTime() AsStringGetReturn m_PostedDateTime
EndGetSet(ByVal value AsString)
m_PostedDateTime = value
EndSetEndPropertyPrivate m_PostedDateTime AsString''' <summary>''' The job instance status.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty Queue() AsStringGetReturn m_Queue
EndGetSet(ByVal value AsString)
m_Queue = value
EndSetEndPropertyPrivate m_Queue AsString''' <summary>''' The job instance log entries. This element is only included if the job status is 'Failed' and Transform Manager is configured to include job instance logs for failed jobs.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty Log() AsStringGetReturn m_Log
EndGetSet(ByVal value AsString)
m_Log = value
EndSetEndPropertyPrivate m_Log AsString#Region"WorkItem Attributes Properties"''' <summary>''' This field will contain the Transform Manager job ID for the encoding task.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty JobName() AsStringGetReturn m_JobName
EndGetSet(ByVal value AsString)
m_JobName = value
EndSetEndPropertyPrivate m_JobName AsString''' <summary>''' The watch folder that the job was submitted to.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty Folder() AsStringGetReturn m_Folder
EndGetSet(ByVal value AsString)
m_Folder = value
EndSetEndPropertyPrivate m_Folder AsString''' <summary>''' The unique identifier that is used by Transform Manager to identify a specific job definition.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty JobDefinitionId() AsStringGetReturn m_JobDefinitionId
EndGetSet(ByVal value AsString)
m_JobDefinitionId = value
EndSetEndPropertyPrivate m_JobDefinitionId AsString''' <summary>''' The unique identifier that is used by Transform Manager to identify a specific job template.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty JobTemplateId() AsStringGetReturn m_JobTemplateId
EndGetSet(ByVal value AsString)
m_JobTemplateId = value
EndSetEndPropertyPrivate m_JobTemplateId AsString''' <summary>''' The unique identifier that is used by Transform Manager to identify a specific job scheduler.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty JobSchedulerId() AsStringGetReturn m_JobSchedulerId
EndGetSet(ByVal value AsString)
m_JobSchedulerId = value
EndSetEndPropertyPrivate m_JobSchedulerId AsString''' <summary>''' The job manifest that is created by Transform Manager.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty ManifestName() AsStringGetReturn m_ManifestName
EndGetSet(ByVal value AsString)
m_ManifestName = value
EndSetEndPropertyPrivate m_ManifestName AsString''' <summary>''' The file that triggered the creation of this job instance.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty InstanceFileName() AsStringGetReturn m_InstanceFileName
EndGetSet(ByVal value AsString)
m_InstanceFileName = value
EndSetEndPropertyPrivate m_InstanceFileName AsString''' <summary>''' The date/time of the job status change.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty QueueTime() AsStringGetReturn m_QueueTime
EndGetSet(ByVal value AsString)
m_QueueTime = value
EndSetEndPropertyPrivate m_QueueTime AsString''' <summary>''' The job progress as a percentage-completed value.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty Progress() AsStringGetReturn m_Progress
EndGetSet(ByVal value AsString)
m_Progress = value
EndSetEndPropertyPrivate m_Progress AsString''' <summary>''' The date/time the job was submitted.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty SubmitTime() AsStringGetReturn m_SubmitTime
EndGetSet(ByVal value AsString)
m_SubmitTime = value
EndSetEndPropertyPrivate m_SubmitTime AsString''' <summary>''' The date/time the job was started.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty StartTime() AsStringGetReturn m_StartTime
EndGetSet(ByVal value AsString)
m_StartTime = value
EndSetEndPropertyPrivate m_StartTime AsString''' <summary>''' The date/time the job ended (finished, failed, or canceled).''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty EndTime() AsStringGetReturn m_EndTime
EndGetSet(ByVal value AsString)
m_EndTime = value
EndSetEndPropertyPrivate m_EndTime AsString''' <summary>''' The watch folder priority value.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty Priority() AsStringGetReturn m_Priority
EndGetSet(ByVal value AsString)
m_Priority = value
EndSetEndPropertyPrivate m_Priority AsString''' <summary>''' The current job status.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty Status() AsStringGetReturn m_Status
EndGetSet(ByVal value AsString)
m_Status = value
EndSetEndPropertyPrivate m_Status AsString''' <summary>''' The number of tasks in the job template.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty TaskCount() AsStringGetReturn m_TaskCount
EndGetSet(ByVal value AsString)
m_TaskCount = value
EndSetEndPropertyPrivate m_TaskCount AsString''' <summary>''' The last task index that was reported.''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>PublicProperty TaskIndex() AsStringGetReturn m_TaskIndex
EndGetSet(ByVal value AsString)
m_TaskIndex = value
EndSetEndPropertyPrivate m_TaskIndex AsString#EndRegion#EndRegion''' <summary>''' Parse the Posted XML string into a NotificationModel object instance''' </summary>PublicSharedFunction TryParse(ByVal value AsString, ByRef notification AsNotificationModel) AsBooleanDim success AsBoolean = False
notification = NothingTryDim xReader As System.Xml.XmlReader = System.Xml.XmlReader.Create(New System.IO.StringReader(value))
Dim element As System.Xml.Linq.XElement = System.Xml.Linq.XElement.Load(xReader)
notification = NewNotificationModel()
' Populate the top XML elements valuesTry
notification.Log = GetXElementValue(element, "log")
Catch ex AsException
notification.Log = "<log></log>"EndTry
notification.PostedDateTime = DateTime.Now.ToString()
notification.Queue = GetXElementValue(element, "queue")
' Populate the WorkItem attributes valuesDim wItem As System.Xml.Linq.XElement = NothingIf element IsNotNothingThen
wItem = element.Element("workItem")
EndIf
notification.Folder = GetWorkItemAttributeValue(wItem, "folder")
notification.JobDefinitionId = GetWorkItemAttributeValue(wItem, "jobDefinitionId")
notification.JobTemplateId = GetWorkItemAttributeValue(wItem, "jobTemplateId")
notification.JobSchedulerId = GetWorkItemAttributeValue(wItem, "jobSchedulerId")
notification.ManifestName = GetWorkItemAttributeValue(wItem, "manifestName")
notification.InstanceFileName = GetWorkItemAttributeValue(wItem, "instanceFileName")
notification.QueueTime = GetWorkItemAttributeValue(wItem, "queueTime")
notification.Progress = GetWorkItemAttributeValue(wItem, "progress")
notification.SubmitTime = GetWorkItemAttributeValue(wItem, "submitTime")
notification.StartTime = GetWorkItemAttributeValue(wItem, "startTime")
notification.EndTime = GetWorkItemAttributeValue(wItem, "endTime")
notification.Priority = GetWorkItemAttributeValue(wItem, "priority")
notification.Status = GetWorkItemAttributeValue(wItem, "status")
notification.TaskCount = GetWorkItemAttributeValue(wItem, "taskCount")
notification.TaskIndex = GetWorkItemAttributeValue(wItem, "taskIndex")
notification.JobName = GetWorkItemAttributeValue(wItem, "jobName")
success = TrueCatch e AsExceptionConsole.WriteLine(e.Message)
EndTryReturn success
EndFunctionPublicSharedFunction GetXElementValue(ByVal element As System.Xml.Linq.XElement, ByVal name As System.Xml.Linq.XName) AsStringDim value AsString = NothingIf element IsNotNothingThen
value = element.Element(name).ToString
EndIfReturn value
EndFunctionPublicSharedFunction GetWorkItemAttributeValue(ByVal element As System.Xml.Linq.XElement, ByVal name As System.Xml.Linq.XName) AsStringDim value AsString = NothingIf element IsNotNothingThen
value = element.Attribute(name).ToString
EndIfReturn value
EndFunctionEndClass
Little more info on this after digging through more logs..
Exception message: A potentially dangerous Request.Form value was detected from the client (<IISTransformManager><queue notificationTimeUtc="...6">Running</queue><workItem jo...").
Trying to disable this I have added: <%@ Page validateRequest="false" %> and still no joy.
I'll try to give your code sample a try within the next week. But have you tried running the web application under Visual Studio and setting a BreakPoint in the Page_Load ? Also, you can try adding some logging logic in the code here and there to find
out where it crashes.
The error 500 means internal error on the server... most likely the web application is throwing an exception of some sorts.
The application loads with no issue. Additionally the results expected (xml post written to text file) works with no issues when utilizing a standard HTTP post program such as:
http://teleflow.org/wiki/index.php5?title=HTTP_XML_Post_testing_tool
or
http://soft-net.net/SendHTTPTool.aspx (run this in xp compatability)
When using the http posting tools the breakpoints set on page load and throughout the method are hit. However the breakpoints do not get hit when messages are sent via Transform Manager. Possibly missing something in the web.config to disable potentially
dangerous requests?
jmulca
5 Posts
Transform Manager Notification HTTP Post
Oct 27, 2011 08:43 PM|LINK
I'm trying to setup the transform manager notification service following the guide located here:
http://learn.iis.net/page.aspx/1031/sending-transform-manager-job-status-notifications-to-a-remote-web-application/
I have an asp.net website up and running with a page post.aspx in the root directory. For testing purposes I am writing the results to a local file.
If I run an http post tester with the message being posted shown below in the post message my results are written to the file with no issues.
However if Transform Manager tries to send the notification I receive the following error in windows event log:
The thread posting the notification message to http://localhost/post.aspx failed: The remote server returned an error: (500) Internal Server Error.. Message being posted :
<IISTransformManager><queue notificationTimeUtc="2011-10-27 20:16:01.5849">Failed</queue><workItem jobName="20111027201553_C40C184D5E8C4F368504489A9E8F8D22" folder="C:\SVN\Video\MyFailFolder" jobDefinitionId="f8e4fc67-5da1-4ac2-9c0b-3b6646b85a71" jobTemplateId="56025acd-badb-4a77-8b76-9d8839206092" jobSchedulerId="00000000-0000-0000-0000-000000000000" manifestName="20111027201553_C40C184D5E8C4F368504489A9E8F8D22.smil" instanceFileName="New Text Document.txt" queueTime="2011-10-27T20:16:01.5849696Z" progress="100" submitTime="2011-10-27T20:15:54.3875579Z" startTime="2011-10-27T20:15:54.4135594Z" endTime="2011-10-27T20:16:01.5759691Z" priority="3" status="Failed" taskCount="1" taskIndex="1" /></IISTransformManager>
Any ideas?...
----- BEGIN POST.aspx ---
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="post.aspx.vb" Inherits="test_post" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> </div> </form> </body> </html>
jmulca
5 Posts
Re: Transform Manager Notification HTTP Post
Oct 27, 2011 09:18 PM|LINK
Little more info on this after digging through more logs..
Exception message: A potentially dangerous Request.Form value was detected from the client (<IISTransformManager><queue notificationTimeUtc="...6">Running</queue><workItem jo...").
Trying to disable this I have added: <%@ Page validateRequest="false" %> and still no joy.
Doiron
114 Posts
Microsoft
Re: Transform Manager Notification HTTP Post
Oct 27, 2011 09:21 PM|LINK
I'll try to give your code sample a try within the next week. But have you tried running the web application under Visual Studio and setting a BreakPoint in the Page_Load ? Also, you can try adding some logging logic in the code here and there to find out where it crashes.
The error 500 means internal error on the server... most likely the web application is throwing an exception of some sorts.
IIS 7 Transform Manager
Doiron
114 Posts
Microsoft
Re: Transform Manager Notification HTTP Post
Oct 27, 2011 09:25 PM|LINK
If the Web Application is not even loading, you might get a bit more details from IIS Failed Request Tracing
http://learn.iis.net/page.aspx/266/troubleshooting-failed-requests-using-tracing-in-iis/
partway in the page you'll find a "Enable Failed-Request Tracing" section that explains how to enable the FREB traces.
This will give you more details about the request comming in and why it threw a 500.
Regards,
IIS 7 Transform Manager
jmulca
5 Posts
Re: Transform Manager Notification HTTP Post
Oct 27, 2011 09:42 PM|LINK
The application loads with no issue. Additionally the results expected (xml post written to text file) works with no issues when utilizing a standard HTTP post program such as:
http://teleflow.org/wiki/index.php5?title=HTTP_XML_Post_testing_tool
or
http://soft-net.net/SendHTTPTool.aspx (run this in xp compatability)
When using the http posting tools the breakpoints set on page load and throughout the method are hit. However the breakpoints do not get hit when messages are sent via Transform Manager. Possibly missing something in the web.config to disable potentially dangerous requests?
------ root web.config ---------
jmulca
5 Posts
Re: Transform Manager Notification HTTP Post
Oct 27, 2011 10:26 PM|LINK
I was able to get it to work with the following setting added to my web.config
<httpRuntime requestValidationMode="2.0" />
Doiron
114 Posts
Microsoft
Re: Transform Manager Notification HTTP Post
Oct 27, 2011 11:27 PM|LINK
Great to hear it's working..
Thank you for sharing the solution!
IIS Transform Manager
CallethOrnel...
4 Posts
Re: Transform Manager Notification HTTP Post
Mar 23, 2012 10:41 AM|LINK
CallethOrnel...
4 Posts
Re: Transform Manager Notification HTTP Post
Mar 23, 2012 03:32 PM|LINK
transfom manager
CallethOrnel...
4 Posts
Re: Transform Manager Notification HTTP Post
Mar 23, 2012 04:31 PM|LINK
transfom manager issue