You must provide a request body if you set ContentLength or SendChunked....etc

3,202 views
Skip to first unread message

Nono

unread,
Feb 10, 2012, 4:22:40 PM2/10/12
to google-ca...@googlegroups.com
Google.Apis.Calendar.v3.Data.Calendar calendar = new Google.Apis.Calendar.v3.Data.Calendar();
        calendar.Summary = NomCalendrier(email);
        calendar.TimeZone = "Europe/Paris";
        calendar.Description = xml.OuterXml;
        calendar.Location = "France";

CalendarsResource.InsertRequest requete = service.Calendars.Insert(calendar);
            requete.Body = calendar;
            requete.Fetch();

i'm using calendar V3 with asp.net 4, and when creating calendar with this code, i have an error : You must provide a request body if you set ContentLength  or SendChunked....etc

can you help me ?

Alain Vongsouvanh

unread,
Feb 13, 2012, 12:35:50 PM2/13/12
to google-ca...@googlegroups.com
Hello,

Unfortunately, I don't have a test environment for .NET, but have you tried using the code snippets available in the documentation:


Calendar calendar = new Calendar()
   
{
     
Summary = "calendarSummary",
     
TimeZone = "America/Los_Angeles"
   
};

Calendar createdCalendar = service.Calendars.Insert(calendar).Fetch();

Console.WriteLine(createdCalendar.Id);


Best,
Alain

--
You received this message because you are subscribed to the Google Groups "Google Calendar API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-calendar-api/-/lJ0W9mzuhyEJ.
To post to this group, send email to google-ca...@googlegroups.com.
To unsubscribe from this group, send email to google-calendar...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-calendar-api?hl=en.



--
Alain Vongsouvanh | Developer Programs Engineer

Nono

unread,
Feb 14, 2012, 5:03:50 PM2/14/12
to google-ca...@googlegroups.com
my code works, but an error appear randomly when creating calendar it's a real probleme for my application because user can't create calendar and it's very very bad and strange

google return this error when fetching a new calendar : 

You must provide a request body if you set ContentLength>0 or SendChunked==true.  Do this by calling [Begin]GetRequestStream before [Begin]GetResponse.
System.Net.ProtocolViolationException: You must provide a request body if you set ContentLength>0 or SendChunked==true.  Do this by calling [Begin]GetRequestStream before [Begin]GetResponse.

Nono

unread,
Feb 15, 2012, 10:41:37 AM2/15/12
to google-ca...@googlegroups.com
I still have the probleme it's seem to be a bug, but how can i continue to create calendar correctly ?

is there a limitation about number of calendar ? should i use a specific compression ? i use description of calendar with xml could it be a probleme (i use it like this since one year) ? 

what can i do ??

Chris Hastings

unread,
Mar 13, 2012, 11:26:16 AM3/13/12
to google-ca...@googlegroups.com
Hi Nano,
I also get this error sporadically. Have you been able to find anything?

Nono

unread,
Mar 13, 2012, 11:31:43 AM3/13/12
to google-ca...@googlegroups.com
hi

no i think i find but problem appear again, it's very bad

i think it's because i use a lof of calendar, do you use a lot of too ?

Nono

unread,
Mar 22, 2012, 6:08:32 PM3/22/12
to google-ca...@googlegroups.com
Hi, do you find a solution ?


Le mardi 13 mars 2012 16:26:16 UTC+1, Chris Hastings a écrit :

Alain Vongsouvanh

unread,
Mar 23, 2012, 2:23:31 PM3/23/12
to google-ca...@googlegroups.com
Hello,

Are you using any packet sniffer when debugging? I know that this issue can occur when using one due to some race condition when opening the HTTP request stream.

Best,
Alain

--
You received this message because you are subscribed to the Google Groups "Google Calendar API" group.

To post to this group, send email to google-ca...@googlegroups.com.
To unsubscribe from this group, send email to google-calendar...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-calendar-api?hl=en.

Arnaud Caroulle

unread,
Mar 23, 2012, 4:12:30 PM3/23/12
to google-ca...@googlegroups.com
mmm, badly, i dont have error when debugging, but in run on server who store my website...

can you clarify ? it's interesting but this issue only happened when creating calendars, no probleme when reading calendar or event, and no problem when creating and updating events, and website use a lot of events...



2012/3/23 Alain Vongsouvanh <ala...@google.com>

Matt

unread,
Apr 16, 2012, 12:07:26 PM4/16/12
to google-ca...@googlegroups.com
Had the same issue and finally found it listed as a known defect with a posted temporary solution.  Not sure if you are using 'google-api-dotnet-client' library, but I was and this fixed the issue for me.

Thanks,
Matt
Reply all
Reply to author
Forward
0 new messages