Copy link to clipboard
Copied
Hi,
I created the schedule runs every 30 minutes. It shows the last run in Oct-10-2018 08:20:00AM, but I didn't get anything. I then click on the green icon to manually run the schedule task and it was was completed successfully, but again, I didn't receive anything. I then try to manually copy the url and run it in the browser and it worked.
Can anyone please help?
Copy link to clipboard
Copied
kt03 wrote
I didn't get anything.
What are you expecting to get?
Copy link to clipboard
Copied
I am testing to send email to me
<cfmail
to="hmyemail@.com"
from="no-reply@test.com"
subject="***TEST TEST"
type="html">
</cfmail>
I save the file into log to find out if permission related it. The log show No authentication........ I wonder why, because some other tasks were actually ran successful with the data.
Copy link to clipboard
Copied
kt03 wrote
I save the file into log to find out if permission related it. The log show No authentication........
What specifically is not authenticated?
Copy link to clipboard
Copied
the log file shows below. I reboot the server but still doesn't work.
Copy link to clipboard
Copied
KT, this is a pretty classic problem. You're trying to run a scheduled task, and it fails. So you grab the URL and run it in a browser, and it works, and you wonder "what is wrong?"
What is wrong is that when you visit the URL in our browser, you benefit from whatever capabilities that browser has (whether built-in or from your having visited the site previously).
But when CF runs the task, note that CF is acting as the browser. It's the same browser that also underlies the CFHTTP tag. if you were o setup a test page that did such a CFHTTP of the URL in question, and then if you dumped the #cfhttp# variable, you'd see similar errors to what you see when you log the output of the task.
And the problem is that the underlying CF browser (the Java httpclient class) does NOT always have the same capabilities as your browser. In this case, your error shows that the page you are visiting (the one doing the cfmail) is held on a web server that is requiring a form of authentication that the httpclient isn't supporting. Or that authentication is expecting additional info that you are not providing in the call to the page.
Notice above I said how your browser may have info from a previous visit to a site. In this case if you visited your site (on which this cfmail page lives) in the past, and that site required you to login (such as with basic authentication), then the browser would remember that username and password and use it in subsequent visits.
But the httpclient browser doesn't remember such things--and you need to tell CF to use a given username and password each time the page is called, whether with the username and password fields in the scheduled task setup, or in a cfhttp call that you make. So first, try adding those.
Second, though, it may be that your web site (hosting that page you're calling) requires "windows authentication", and though cfhttp was said to add NTLM (which some would say is the same thing), I have not had luck with tests of that. I can confirm that as soon as I changed IIS (for a test folder in a test site) to not support "anonymous" authentication and selected another, the error I saw was the same one you saw.
Let us know if you can find more about your web server setup, and whether adding a username/password to your task helps. If not, you may need to consider putting the page (that you want to call) in a folder that has some other form of protection, if you need it (such as only allowing it to be called from the IP of the CF server itself).
Let us know if that helps.
Copy link to clipboard
Copied
Thank you , can you please show me to get to the location where I can see the thing below?
I changed IIS (for a test folder in a test site) to not support "anonymous" authentication and selected another,
Copy link to clipboard
Copied
Seriously, you could easily Google that. 🙂
At either the server, site, or folder level, select the authentication "feature" (the buttons in the middle of the page when in iis). Double click it to see and change the choices offered.
Copy link to clipboard
Copied
Thank you very much .
Copy link to clipboard
Copied
kt03 wrote
I then try to manually copy the url and run it in the browser and it worked.
Are you doing that on you workstation or on the server?
You need to log into the server and use a browser on the server to test accessing the URL.
It is possible that the address is working from a workstation, but not on the server itself. You can try to use "localhost" for the ColdFusion task, since the task is running on the server.
Copy link to clipboard
Copied
I was try on my workstation. Not sure which credentials I will try on the server?, mine credentials?, or the one I used to create the datasource? IIf I use mine, got error below. I think i should try with the datasource credentials?
Copy link to clipboard
Copied
For this test, the credentials don't matter.
Did you test using "localhost" instead of the domain in the URL?
Copy link to clipboard
Copied
no, I don't know how to test it
Copy link to clipboard
Copied
kt03 wrote
I was try on my workstation. Not sure which credentials I will try on the server?, mine credentials?, or the one I used to create the datasource? IIf I use mine, got error below. I think i should try with the datasource credentials?
HTTP Error 401.1 - Unauthorized
You do not have permission to view this directory or page using the credentials that you supplied.
That sounds like an IIS error. If so, then the usual fix is to enable Anonymous Authentication is IIS. Google it.