none
There is a Problem in namespace System.Net.WebClient Methed UploadValues RRS feed

  • 问题

  • Hi~

       I 'm  falling into a trouble recently,  My project used  WebClient  class ,but there has some bug in UploadValues methed,

    I post some value into other webserver,but some time broken 500 error,and I don't know it's from my servers or other servers, and  there is code:

       WebClient WebClientObj = new WebClient();
                    NameValueCollection PostVars = new NameValueCollection();
                    PostVars.Add("openid", openid);
                    PostVars.Add("content", message);
                    PostVars.Add("contentType", "1");
                    byte[] byRemoteInfo = WebClientObj.UploadValues(ConfigurationManager.AppSettings["weixin_send_url"], "POST", PostVars);
                   
           Hope You Help Out!!! Thanks a lot 


    2015年2月10日 7:57

答案

  • Hi,

    The HTTP Error 500 defines that a serverside error is occured during the execution of a request. That means that the server code throwed an exception.

    There are two big areas you can have a look. At first on the server code itself. It seems that some of your request data brings the server code to crash. If you are sure that the server code works correct but there are only some issue with the error handling you can have a look to your client code. 
    Maybe the client sent the wrong request data to the server. To verify this you could try to use Fiddler to have test about this.

    Regards

    2015年2月16日 2:29
    版主
  • Hi,

    >>could it be mean this is my server's problem

    It depends.

    If you are sure that the server code works correct but there are only some issue with the error handling you can have a look to your client code. 

    Maybe the client sent the wrong request data to the server, and the server could not get the valide request, so the server can not give a response to the request.

    Regards

    2015年2月17日 0:55
    版主

全部回复

  • Hi,

    The HTTP Error 500 defines that a serverside error is occured during the execution of a request. That means that the server code throwed an exception.

    There are two big areas you can have a look. At first on the server code itself. It seems that some of your request data brings the server code to crash. If you are sure that the server code works correct but there are only some issue with the error handling you can have a look to your client code. 
    Maybe the client sent the wrong request data to the server. To verify this you could try to use Fiddler to have test about this.

    Regards

    2015年2月16日 2:29
    版主
  • Thanks for answer.

    could it be mean this is my server's problem. but at most of time  system running normally ,sometimes happened in the same code.

    2015年2月16日 5:51
  • Hi,

    >>could it be mean this is my server's problem

    It depends.

    If you are sure that the server code works correct but there are only some issue with the error handling you can have a look to your client code. 

    Maybe the client sent the wrong request data to the server, and the server could not get the valide request, so the server can not give a response to the request.

    Regards

    2015年2月17日 0:55
    版主
  •          THANK YOU VERY MUCH,Shavn Zhao

             Go home for the Spring Festival. just come back.it is high time that this problem was solved.

    2015年2月25日 9:38