Click here to Skip to main content
14,487,321 members
Rate this:
Please Sign up or sign in to vote.
See more:
In my application i write insert, delete function in C#. I need to check those functions in Restapi. Whenever i check it says error and in function parameters are always null. My c# code is,

        public HttpResponseMessage InsertOrganizationDetails(Organization[] Organization)
                return new HttpResponseMessage()
                    Content = new StringContent(string.Concat(crudorganization.InsertOrganizationDetails(Organization)), Encoding.UTF8, "application/json")
            catch (Exception ex)
                RevshopWebAPI.Global.LogFile.Log.WriteLog("Exception in method - GetOrganizationDetails ", ex.ToString(), RevshopWebAPI.Global.LogType.Error);
                return Request.CreateResponse(HttpStatusCode.BadRequest);

The following is inside crudorganization class,

public object InsertOrganizationDetails(Organization[] Organization)
                DataSet ds = new DataSet();

                for (int i = 0; i < Organization.Length; i++)
                    object[] objParamValue = { Organization[i].Type, Organization[i].Parent, Organization[i].Company, Organization[i].Address_1, Organization[i].Address_2, Organization[i].City, Organization[i].State, Organization[i].Zip, Organization[i].Country, Organization[i].Phone, Organization[i].Fax };

                    ds = sqlHelper.GetDataset(connStr, Procedures.InsertOrganizationDetails, ProcedureParams.InsertOrganizationDetailsParameter, objParamValue);

                return jsonUtility.serializetoJSON("1");
            catch (Exception ex)
                LogFile.Log.WriteLog(ex.ToString(), ex.Message);
                throw ex;

Whenever i tried in API and select post option then click send button i get the following error message,

Abort / timeout

The request has been aborted manually or because of the conection timeout. There were no response from the server but the connection wasn't closed.

You can adjust timeout in settings.

Try to:

add "Connection: close" header which should be used by the server to close the connection after it finish generating response
Please, check if:

all required services (like www) are up and running on server
method is correct
port number is correct
url is correct
all required headers and/or payload has been added to the request

Sometimes it may happen when you use http protocol instead of https. Also it may happen when you use different URL (port / protocol) and the server is not configured properly.

Please help me.

What I have tried:

I am not getting what ever i tried.
Updated 3-Oct-16 0:48am
David_Wimbley 3-Oct-16 9:55am
Without you posting what you are sending as test data I don't think it'll be feasible to help you at the moment.

For example, your issue could be in your content type headers you are using, or it could be that you are sending a JSON string instead of form data array.

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100