Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I faced issue with reading large data using ajax request: from javascript to C#.

Notes :

1- I have set to maxRequestLength="52428800" and maxAllowedContentLength="52428800"

2- The request worked successfully for normal data.

And I still get: 500 (Internal Server Error) for large data case. And every thing is okay for small or normal data size.

What I have tried:

1- I have set to maxRequestLength="52428800" and maxAllowedContentLength="52428800"

2- The request worked successfully for normal data.
Posted
Updated 29-Nov-18 0:08am
v2
Comments
F-ES Sitecore 28-Nov-18 6:00am    
What happens when you try? Is it a timeout, an overflow, an error? Does your controller code get called ok and go to the end? Do you get errors in the browser console? Have you looked at the call in the network tab of the browser tools?
Ameer Salah 28-Nov-18 6:10am    
And I still get: 500 (Internal Server Error) for large data case. And everything is okay for small or normal data size.
F-ES Sitecore 28-Nov-18 6:15am    
That means your server code is probably throwing an error. If you look at the response to the call in the network tab of the browser tools it often has more information about the error (assuming you have friendly errors disabled). Also debug the server call to see what is happening there.
Ameer Salah 28-Nov-18 6:21am    
okay but this just happens for big requests.
MadMyche 28-Nov-18 7:04am    
How big is the actual file? How long does it take to throw the error? What is being logged in the w3 service log? Do you really need AspNet to be able to accept a 50GB upload?

500 errors mean your server-side code crashed or otherwise threw an error. Unless YOU go through some diagnostic steps on your own code and supply additional information in your question, NOBODY can tell you what's going wrong with what you've posted in your question.

We only get to work with what you put in the question, and you've supplied no usable information in your question at all.

You're going to have to run your code under the debugger and/or add logging to the code to show it's progress to a file or database.

Have you looked in the servers Application Event Log? Have you checked the IIS logs for any messages related to the crash?
 
Share this answer
 
Comments
Ameer Salah 29-Nov-18 6:27am    
Hello Dave,
Okay, so basically we trying to get info from some file in the server which has 3 or 2 version then do the merge between the versions.
in order to display file data we get the data in json when the file is less than one mb every thing is okay but when the file bigger than 2m 500 internal server error will be raised
Dave Kreskowiak 29-Nov-18 8:37am    
OK, and that doesn't mean anything at all to the errors. You're code is doing something wrong and since we can't see the code, it's still impossible for anyone to tell you anything useful, other than run it under the debugger.
try anther internet connection without any domain Administration
 
Share this answer
 
Comments
Dave Kreskowiak 29-Nov-18 8:38am    
Are you kidding? How does that affect errors in the code running on the server?

HTTP 500 errors are always code or configuration related on the server.
Ameer Salah 12-Dec-18 8:06am    
ajax:
function saveTheResult() {
checkAndCompareEditorToArrayVal();

var contentValue = editor.getValue().replace(/<no src line>/g, '\n');;
var uri = '../../../ThreeWayMerge/SaveTheResult';
$.ajax({
type: "POST",
url: uri,
processData: false,
contentType: 'application/json',
data: JSON.stringify({
'mergeSessionId': window.mergeSessionId,
'fileId': window.fileId,
'content': contentValue,
'savedResult': JSON.stringify(KdiffResult),
}),
success: function (data) {
if (data.status_code == 200) {
window.location.href = absolute("/merge_sessions/" + window.mergeSessionId);
initEditors(true);
}
}
}).fail(function () {
showStatusModal('Something went wrong', 'An unexpected error has occurred. Please try again later. Contact support if the error persists.');
});
}

Controller:
[HttpPost]
public async System.Threading.Tasks.Task<actionresult> SaveTheResult(string fileID, string mergeSessionId, string content, string savedResult)
{
var client = new HttpClient();
TempData["downloadable"] = "no";
// Validate Merge conflict server side
var response = new Dictionary<string, string>();
if (content.Contains("<Merge conflict>"))
{
response.Add("msg", "Please Resolve Conflicts before");
response.Add("code", "500");
return Json(response, JsonRequestBehavior.AllowGet);
}
var values = new Dictionary<string, string>
{
{ "content", content},
{ "diff_final_result", savedResult},
};
var SaveResutInfo = await requestHelper.DoPostRequest(string.Format(BEServerUrls.SaveFileContentUrl, mergeSessionId, fileID), values);
TempData["downloadable"] = "yes";
return Json(SaveResutInfo, JsonRequestBehavior.AllowGet);
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900