Exchange Web Services - The request failed. The remote server returned an error: (413) Request Entity Too...
I have this simple code snippet, where I try to fetch folders from specific mailbox
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials("ADMIN_USER@corp.contoso.com", "********");
Mailbox mb = new Mailbox("chris@corp.contoso.com");
FolderId fid = new FolderId(WellKnownFolderName.MsgFolderRoot, mb);
// Set the URL.
service.Url = new Uri("https://<exchange>/EWS/Exchange.asmx");
var findResults = service.FindFolders(
fid,
new FolderView(int.MaxValue) { Traversal = FolderTraversal.Deep }
);
foreach(var result in findResults)
{
//result.Load();
Console.WriteLine(result.DisplayName);
}
It worked fine before, but today's morning it started to return this error
Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The remote server returned an error: (413) Request Entity Too Large. ---> System.Net.WebException: The remote server returned an error: (413) Request Entity Too Large.
I tried different ways to solve it - mostly by increasing request entity size limit, but it does not help. I suppose code is fine, but VM or Exchange configuration need to be adjusted. Please advice how to solve it, thanks.
c# exchangewebservices exchange-server-2016
add a comment |
I have this simple code snippet, where I try to fetch folders from specific mailbox
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials("ADMIN_USER@corp.contoso.com", "********");
Mailbox mb = new Mailbox("chris@corp.contoso.com");
FolderId fid = new FolderId(WellKnownFolderName.MsgFolderRoot, mb);
// Set the URL.
service.Url = new Uri("https://<exchange>/EWS/Exchange.asmx");
var findResults = service.FindFolders(
fid,
new FolderView(int.MaxValue) { Traversal = FolderTraversal.Deep }
);
foreach(var result in findResults)
{
//result.Load();
Console.WriteLine(result.DisplayName);
}
It worked fine before, but today's morning it started to return this error
Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The remote server returned an error: (413) Request Entity Too Large. ---> System.Net.WebException: The remote server returned an error: (413) Request Entity Too Large.
I tried different ways to solve it - mostly by increasing request entity size limit, but it does not help. I suppose code is fine, but VM or Exchange configuration need to be adjusted. Please advice how to solve it, thanks.
c# exchangewebservices exchange-server-2016
add a comment |
I have this simple code snippet, where I try to fetch folders from specific mailbox
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials("ADMIN_USER@corp.contoso.com", "********");
Mailbox mb = new Mailbox("chris@corp.contoso.com");
FolderId fid = new FolderId(WellKnownFolderName.MsgFolderRoot, mb);
// Set the URL.
service.Url = new Uri("https://<exchange>/EWS/Exchange.asmx");
var findResults = service.FindFolders(
fid,
new FolderView(int.MaxValue) { Traversal = FolderTraversal.Deep }
);
foreach(var result in findResults)
{
//result.Load();
Console.WriteLine(result.DisplayName);
}
It worked fine before, but today's morning it started to return this error
Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The remote server returned an error: (413) Request Entity Too Large. ---> System.Net.WebException: The remote server returned an error: (413) Request Entity Too Large.
I tried different ways to solve it - mostly by increasing request entity size limit, but it does not help. I suppose code is fine, but VM or Exchange configuration need to be adjusted. Please advice how to solve it, thanks.
c# exchangewebservices exchange-server-2016
I have this simple code snippet, where I try to fetch folders from specific mailbox
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials("ADMIN_USER@corp.contoso.com", "********");
Mailbox mb = new Mailbox("chris@corp.contoso.com");
FolderId fid = new FolderId(WellKnownFolderName.MsgFolderRoot, mb);
// Set the URL.
service.Url = new Uri("https://<exchange>/EWS/Exchange.asmx");
var findResults = service.FindFolders(
fid,
new FolderView(int.MaxValue) { Traversal = FolderTraversal.Deep }
);
foreach(var result in findResults)
{
//result.Load();
Console.WriteLine(result.DisplayName);
}
It worked fine before, but today's morning it started to return this error
Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The remote server returned an error: (413) Request Entity Too Large. ---> System.Net.WebException: The remote server returned an error: (413) Request Entity Too Large.
I tried different ways to solve it - mostly by increasing request entity size limit, but it does not help. I suppose code is fine, but VM or Exchange configuration need to be adjusted. Please advice how to solve it, thanks.
c# exchangewebservices exchange-server-2016
c# exchangewebservices exchange-server-2016
asked Jan 2 at 17:02
Alexander KrylykAlexander Krylyk
164
164
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You shouldn't be doing this
new FolderView(int.MaxValue) { Traversal = FolderTraversal.Deep }
It won't work anyway because the maximum number of items that EWS will return will be 1000 anyway so you should implemented proper paging in your code https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-perform-paged-searches-by-using-ews-in-exchange else your code will fail when the Mail folder count exceeds 1000.
Before you adjust any server settings i would suggest you test EWS using something like the EWS Editor https://github.com/dseph/EwsEditor/releases if that works but your code doesn't then you know the problem lies at the source rather then the destination. There are very few instance where you should ever change IIS setting on a Exchange server for that type of request it shouldn't be necessary (maybe large attachments are the only one I can think off). So i would look at what else may have been recently installed on that server.
Thanks for quick response, @Glen. I tried to use different values inFolderView
, but evennew FolderViev(1)
returns 413 error. Also I have tried EWS editor you recommended - same error, even same callstack. Please look at the screenshot here. There is nothing installed on VM but Exchange 2016. I have tuned it to use remote powershell - that is all work I did.
– Alexander Krylyk
Jan 3 at 8:21
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54010319%2fexchange-web-services-the-request-failed-the-remote-server-returned-an-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You shouldn't be doing this
new FolderView(int.MaxValue) { Traversal = FolderTraversal.Deep }
It won't work anyway because the maximum number of items that EWS will return will be 1000 anyway so you should implemented proper paging in your code https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-perform-paged-searches-by-using-ews-in-exchange else your code will fail when the Mail folder count exceeds 1000.
Before you adjust any server settings i would suggest you test EWS using something like the EWS Editor https://github.com/dseph/EwsEditor/releases if that works but your code doesn't then you know the problem lies at the source rather then the destination. There are very few instance where you should ever change IIS setting on a Exchange server for that type of request it shouldn't be necessary (maybe large attachments are the only one I can think off). So i would look at what else may have been recently installed on that server.
Thanks for quick response, @Glen. I tried to use different values inFolderView
, but evennew FolderViev(1)
returns 413 error. Also I have tried EWS editor you recommended - same error, even same callstack. Please look at the screenshot here. There is nothing installed on VM but Exchange 2016. I have tuned it to use remote powershell - that is all work I did.
– Alexander Krylyk
Jan 3 at 8:21
add a comment |
You shouldn't be doing this
new FolderView(int.MaxValue) { Traversal = FolderTraversal.Deep }
It won't work anyway because the maximum number of items that EWS will return will be 1000 anyway so you should implemented proper paging in your code https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-perform-paged-searches-by-using-ews-in-exchange else your code will fail when the Mail folder count exceeds 1000.
Before you adjust any server settings i would suggest you test EWS using something like the EWS Editor https://github.com/dseph/EwsEditor/releases if that works but your code doesn't then you know the problem lies at the source rather then the destination. There are very few instance where you should ever change IIS setting on a Exchange server for that type of request it shouldn't be necessary (maybe large attachments are the only one I can think off). So i would look at what else may have been recently installed on that server.
Thanks for quick response, @Glen. I tried to use different values inFolderView
, but evennew FolderViev(1)
returns 413 error. Also I have tried EWS editor you recommended - same error, even same callstack. Please look at the screenshot here. There is nothing installed on VM but Exchange 2016. I have tuned it to use remote powershell - that is all work I did.
– Alexander Krylyk
Jan 3 at 8:21
add a comment |
You shouldn't be doing this
new FolderView(int.MaxValue) { Traversal = FolderTraversal.Deep }
It won't work anyway because the maximum number of items that EWS will return will be 1000 anyway so you should implemented proper paging in your code https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-perform-paged-searches-by-using-ews-in-exchange else your code will fail when the Mail folder count exceeds 1000.
Before you adjust any server settings i would suggest you test EWS using something like the EWS Editor https://github.com/dseph/EwsEditor/releases if that works but your code doesn't then you know the problem lies at the source rather then the destination. There are very few instance where you should ever change IIS setting on a Exchange server for that type of request it shouldn't be necessary (maybe large attachments are the only one I can think off). So i would look at what else may have been recently installed on that server.
You shouldn't be doing this
new FolderView(int.MaxValue) { Traversal = FolderTraversal.Deep }
It won't work anyway because the maximum number of items that EWS will return will be 1000 anyway so you should implemented proper paging in your code https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-perform-paged-searches-by-using-ews-in-exchange else your code will fail when the Mail folder count exceeds 1000.
Before you adjust any server settings i would suggest you test EWS using something like the EWS Editor https://github.com/dseph/EwsEditor/releases if that works but your code doesn't then you know the problem lies at the source rather then the destination. There are very few instance where you should ever change IIS setting on a Exchange server for that type of request it shouldn't be necessary (maybe large attachments are the only one I can think off). So i would look at what else may have been recently installed on that server.
answered Jan 2 at 23:15
Glen ScalesGlen Scales
12k11116
12k11116
Thanks for quick response, @Glen. I tried to use different values inFolderView
, but evennew FolderViev(1)
returns 413 error. Also I have tried EWS editor you recommended - same error, even same callstack. Please look at the screenshot here. There is nothing installed on VM but Exchange 2016. I have tuned it to use remote powershell - that is all work I did.
– Alexander Krylyk
Jan 3 at 8:21
add a comment |
Thanks for quick response, @Glen. I tried to use different values inFolderView
, but evennew FolderViev(1)
returns 413 error. Also I have tried EWS editor you recommended - same error, even same callstack. Please look at the screenshot here. There is nothing installed on VM but Exchange 2016. I have tuned it to use remote powershell - that is all work I did.
– Alexander Krylyk
Jan 3 at 8:21
Thanks for quick response, @Glen. I tried to use different values in
FolderView
, but even new FolderViev(1)
returns 413 error. Also I have tried EWS editor you recommended - same error, even same callstack. Please look at the screenshot here. There is nothing installed on VM but Exchange 2016. I have tuned it to use remote powershell - that is all work I did.– Alexander Krylyk
Jan 3 at 8:21
Thanks for quick response, @Glen. I tried to use different values in
FolderView
, but even new FolderViev(1)
returns 413 error. Also I have tried EWS editor you recommended - same error, even same callstack. Please look at the screenshot here. There is nothing installed on VM but Exchange 2016. I have tuned it to use remote powershell - that is all work I did.– Alexander Krylyk
Jan 3 at 8:21
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54010319%2fexchange-web-services-the-request-failed-the-remote-server-returned-an-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown