microsoft-teamsexchange-server-2016

Teams calendar requests causes Exchange Server 2016 to log unhandled exception (maxQueryStringLength)


Teams calendar requests causes Exchange Server 2016 to log unhandled exception (maxQueryStringLength)

Our on-premises Exchange Server 2016 is logging unhandled exceptions – it appears to be Teams querying calendar data via REST API.

In the event log: (example.com is our on-premises Exchange Server)

Exception information: 
    Exception type: HttpException 
    Exception message: The length of the query string for this request exceeds the configured maxQueryStringLength value.
   at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
   at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)

Request information: 
    Request URL: https://example.com/api/v2.0/me/calendarView?$top=0&$select=attendees,body,categories,end,hasAttachments,iCalUId,id,isAllDay,isCancelled,isOrganizer,isReminderOn,location,locations,onlineMeetingUrl,organizer,originalEndTimeZone,originalStartTimeZone,reminderMinutesBeforeStart,responseRequested,responseStatus,sensitivity,seriesMasterId,showAs,start,subject,type&startDateTime=2020-03-25T20:46:37Z&endDateTime=2020-03-25T21:46:37Z&$expand=singleValueExtendedProperties($filter=PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name SkypeTeamsMeetingUrl' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name SkypeTeamsProperties' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name SchedulingServiceUpdateUrl' or PropertyId eq 'Integer {00062002-0000-0000-C000-000000000046} Id 0x8217' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name OnlineMeetingConferenceId' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name OnlineMeetingTollNumber' or PropertyId eq 'Binary {6ed8da90-450b-101b-98da-00aa003f1305} Id 0x0023' or PropertyId eq 'Boolean {00020329-0000-0000-C000-000000000046} Name DoNotForward' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name ClientOptimisticEventId' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name OnlineMeetingConfLink' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name TeamsVtcConferenceId' or PropertyId eq 'String {00020329-0000-0000-C000-000000000046} Name TeamsVtcTenantId' or PropertyId eq 'String {6ed8da90-450b-101b-98da-00aa003f1305} Name OnlineMeetingConferenceId' or PropertyId eq 'String {6ed8da90-450b-101b-98da-00aa003f1305} Name OnlineMeetingTollNumber'),multiValueExtendedProperties($filter=PropertyId eq 'StringArray {00020329-0000-0000-C000-000000000046} Name OnlineMeetingTollFreeNumbers' or PropertyId eq 'StringArray {6ed8da90-450b-101b-98da-00aa003f1305} Name OnlineMeetingTollFreeNumbers') 

Solution

  • Edit: "C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\rest\web.config"

    Add

    maxQueryStringLength="10240"

    to

    < httpRuntime />

    e.g. < httpRuntime maxRequestLength="2097151" maxUrlLength="2048" maxQueryStringLength="10240" requestPathInvalidCharacters="<,>,*,%,\,?" requestValidationMode="2.0" />

    I might be out on the size by a mile (max string was ~1956bytes) but this was annoying me to no end.