You must Sign In to post a response.
  • Category: Webservices

    How to solve 500 internal server

    Hi Iam working with some api that not working properly iam getting error like 500 internal server

    how to solve this

    namespace ConsoleBonanzas
    {
    class Program
    {
    static void Main(string[] args)
    {

    string response = "";

    string requesterCredentials = "\"requesterCredentials\": {\"bonanzleAuthToken\": \"mytoken\"},";
    string itemSpecifics = "\"itemSpecifics\": [[\"condition\", \"used\"], [\"danger\", \"extreme\"]],";
    string itemVariations = "\"variations\": [{\"nameValueList\": [{\"name\": \"Colour\", \"value\": \"Blue\"}, {\"name\": \"Style\", \"value\": \"Single\"}], \"quantity\": 3}, {\"nameValueList\": [{\"name\": \"Colour\", \"value\": \"Red\"}, {\"name\": \"Style\", \"value\": \"string\"}], \"quantity\": 1}],";
    string pictureDetails = "\"pictureDetails\": {\"pictureURL\": [\"http://images.discountstarwarscostumes.com/products/9284/1-1/luke-skywalker-blue-ightsaber.jpg\", \"http://www.rankopedia.com/CandidatePix/29862.gif\"]},";
    string itemDescription = "\"description\": \"An elegant weapon, for a more civilized age * SELLER NOT LIABLE FOR DISMEMBERMENT *\",";

    string contentToPost = "addFixedPriceItemRequest={" + requesterCredentials + "\"itemId\": 208617, \"item\": {\"shippingType\": \"Free\"," + itemDescription + "\"title\": \"Lightsaber\", \"price\": 42, \"quantity\": 3," + itemVariations + "\"primaryCategory\": {\"categoryId\": \"163128\"}}";
    response = makeRequest(contentToPost);
    Console.Write("response is" + response);
    Console.Read();
    }


    private static string makeRequest(string contentToPost)
    {
    try
    {
    string Api_url = "https://api.bonanza.com/api_requests/secure_request";
    //System.Net.WebRequest request = System.Net.WebRequest.Create(Api_url);
    HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(Api_url);
    request.Headers.Add("X-BONANZLE-API-DEV-NAME", "mydevname");
    request.Headers.Add("X-BONANZLE-API-CERT-NAME", "mycername");

    // System.Net.ServicePointManager.ServerCertificateValidationCallback = new Net.Security.RemoteCertificateValidationCallback(CertificateValidationCallBack);
    System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CertificateValidationCallBack);

    byte[] contentBytes = System.Text.Encoding.UTF8.GetBytes(contentToPost);

    request.Method = "POST";
    request.AllowAutoRedirect = true;
    request.ContentLength = contentBytes.Length;
    System.IO.Stream requestStream = request.GetRequestStream();
    requestStream.Write(contentBytes, 0, contentBytes.Length);
    System.Console.WriteLine(requestStream);
    //requestStream.Close()

    System.Net.HttpWebResponse response = (HttpWebResponse)request.GetResponse();

    Console.Write("response...." + response);
    // Read the response into a StreamReader
    System.IO.StreamReader responseReader = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8);
    string strResponse = responseReader.ReadToEnd();
    //System.Console.WriteLine(strResponse);
    //System.Console.ReadLine();
    Console.Write(strResponse);
    Console.Read();
    return strResponse;
    }
    catch (Exception ex)
    {
    System.Console.WriteLine("Failed to call Bonanza with content " + contentToPost + ", " + ex.Message );
    throw;
    }
    }

    private static bool CertificateValidationCallBack(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
    {
    return true;
    }
    }
    }
  • #760555
    Hi
    500-internal-server your service or navigate path not found so we canot reach there?

    check your service individual in the browser view browser menu

    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #760559
    Hi

    This occurs because the server that is running IIS cannot access the configured root directory of the requested location.

    Resolution would be to make sure that the server
    that is running IIS can access the configured root
    directory of the requested location.

    Regards

    Sridhar Thota.
    "Poverty means.. Poverty of knowledge.."

    Sridhar Thota.
    Editor: DNS Forum.

  • #769709
    Generally , we used to get 500 internal server error in below cases
    1. Access permission to the specific requested page
    2. Timeout during processing of request
    3. Code error internally which involves server side execution

    so, ensure above below are properly handled to resolve the above 500 internal server error.

    Thanks!
    B.Ramana Reddy


  • Sign In to post your comments