I
I
Igor Kravchenko2015-03-30 10:14:19
IIS
Igor Kravchenko, 2015-03-30 10:14:19

Long server response with a Post request of 100kb, why?

I am using angularjs http(post), asp.net vnext backend running on iis or kestrel
My request is urlencoded:

$scope.editTextSave = function (bookid, partbookId, textOfBookId) {
            $http({
                method: "POST",
                data: "TextBook=" + encodeURIComponent($scope.htmlcontent),
                url: '/Text/EditSave/' + bookid + '/' + partbookId + '/' + textOfBookId,
                type: 'POST',
                headers: { 'Content-Type': 'application/x-www-form-urlencoded' }

            }).success(function (data) {
              
            });
        }

When sending data in the application/x-www-form-urlencoded format, the waiting (ttfb) response is very long (about a minute), I send about 100kb of text in the post.
how to pass json and how post method should be written c#&
How can save text problem be solved?
c# part saves data to the database almost instantly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Kravchenko, 2015-03-30
@Gorniv

request with json data passing, on angularjs http

$scope.editTextSave = function (bookid, partbookId, textOfBookId) {
           $http({
               url: '/Text/EditSave/' + bookid + '/' + partbookId + '/' + textOfBookId,
               method: 'POST',
               data: JSON.stringify({
                  
                   TextId: textOfBookId,
                   TextBook:$scope.htmlcontent,
                   BookId: bookid,
                   PartId: partbookId
               }),
               headers: { 'Content-Type': 'application/json' },
               transformRequest: false
           }).success(function (data) {

           });
       };

web api c# asp.net, without [FromBody] comes null
[HttpPost]
       [Route("Text/EditSave/{booklink?}/{partbookId?}/{textOfBookId?}")]
       public async Task<bool> EditSave([FromBody]TextOfBookViewModel model)
       {
           return true;
       }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question