using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Umbraco.Web.WebApi;
namespace psclistens.Controllers
{
public class BlogApiController : UmbracoApiController
{
public String Import()
{
return "foo";
}
}
}
When run Umbraco, I see this in the UmbracoTraceLog.txt file:
System.Net.ProtocolViolationException: Cannot send a content-body with this verb-type.
at System.Net.HttpWebRequest.CheckProtocol(Boolean onRequestStream)
at System.Net.HttpWebRequest.BeginGetRequestStream(AsyncCallback callback, Object state)
at System.Net.Http.HttpClientHandler.StartGettingRequestStream(RequestState state)
at System.Net.Http.HttpClientHandler.PrepareAndStartContentUpload(RequestState state)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Umbraco.Web.Scheduling.ScheduledTasks.<GetTaskByHttpAync>d__9.MoveNext()
2015-07-23 14:14:19,440 [6] INFO Umbraco.Web.Scheduling.ScheduledTasks - [P2876/T1/D2] import-from-blogs has been called with response: False
I've tried a bunch of different stuff and I always get the same error. I'm beginning to suspect that scheduled tasks are broken in Umbraco 7. Can anyone confirm or deny this?
Sorry my bad when I said on controller. I did try this above on method not controller but it didn't work. I am able to call the url in browser and it does work and perform the required task which proves the url is working fine. Also I tried a different url also which doesn't do anything but that is also not working and giving the same error
================
2015-09-29 14:24:55,369 [135] ERROR Umbraco.Web.Scheduling.ScheduledTasks - [P6844/T104/D3] An error occurred calling web task for url: http://localhost:8080/enjoy
System.Net.ProtocolViolationException: Cannot send a content-body with this verb-type.
===========================
I have seen some post where its said it is fixed in 7.3.0 RC but I want to stay of 7.2.8 version and want a fix. Please suggest.
Umbraco 7 Scheduled Task
I'm trying to set up a scheduled task, but I think I must be missing some key concept. Here's what I've got so far.
In umbracoSettings.config, I've got the following:
Then, I've created an API Controller:
When run Umbraco, I see this in the UmbracoTraceLog.txt file:
Any hints or suggestions would be appreciated.
-- Norman Lynch
I've tried a bunch of different stuff and I always get the same error. I'm beginning to suspect that scheduled tasks are broken in Umbraco 7. Can anyone confirm or deny this?
-- Norman Lynch
Have you tried the [AcceptVerbs("GET")] attribute in your api controller?
Hi,
i think Andrew is right. Try to add [HttpGet] to your method:
}
If it still won´t work, try call a normal url from the taskmanager, to check if it is broken or you have a problem in your api.
Best regards René
Hi,
I have tried above fix by adding "[System.Web.Http.HttpGet]" to API controller but it is still not working. Please suggest.
Thanks
Not sure if that was a typo on René's post - the [HttpGet] decorator needs to go above the method, not the class.
I don't know if this will fix your issue though.
Sorry, my mistake. Thank you Hywel!
@Sanjay, have you tried calling a normal url from scheduletask?
/R
Hi Hywel,
Sorry my bad when I said on controller. I did try this above on method not controller but it didn't work. I am able to call the url in browser and it does work and perform the required task which proves the url is working fine. Also I tried a different url also which doesn't do anything but that is also not working and giving the same error
================ 2015-09-29 14:24:55,369 [135] ERROR Umbraco.Web.Scheduling.ScheduledTasks - [P6844/T104/D3] An error occurred calling web task for url: http://localhost:8080/enjoy System.Net.ProtocolViolationException: Cannot send a content-body with this verb-type.
===========================
I have seen some post where its said it is fixed in 7.3.0 RC but I want to stay of 7.2.8 version and want a fix. Please suggest.
Thanks Sanjay
Hi Sanjay,
do you have an Access-Control-Allow-Origin in your method? Maybe that could make it work.
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
Best René
Hi Rene,
Thanks for your reply but no luck with HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
Do you think you can suggest something else to make it work please?
Thanks Sanjay
was this ever resolved I am getting the same error trying to run a scheduled task:
Umbraco.Web.Scheduling.ScheduledTasks - [P65892/T209/D11] reminderEmails has been called with response: False
Thanks
Nav
Hi Naveed,
I'm getting the same issue as you, did you find a fix in the end?
Thanks
Paul
is working on a reply...