500 internal server error at GetResponse()

后端 未结 8 1851
花落未央
花落未央 2020-12-08 10:37

I have a heavy traffic aspx page calling a web service upon every user`s request as follows.

string uri = \"Path.asmx\";
string soap = \"soap xml string\";

         


        
相关标签:
8条回答
  • 2020-12-08 10:58

    For me the error was misleading. I discovered the true error by testing the errant web service with SoapUI.

    0 讨论(0)
  • 2020-12-08 11:06

    For me this error occurred because I had 2 web API actions that had the exact same signatures and both had the same verbs, HttpPost, what I did was change one of the verbs (the one used for updating) to PUT and the error was removed. The following in my catch statement helped in getting to the root of the problem:

    catch (WebException webex)
    {
                    WebResponse errResp = webex.Response;
                    using (Stream respStream = errResp.GetResponseStream())
                    {
                        StreamReader reader = new StreamReader(respStream);
                        string text = reader.ReadToEnd();
                    }
    }
    
    0 讨论(0)
  • 2020-12-08 11:07

    Have you tried to specify UserAgent for your request? For example:

    request.UserAgent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
    
    0 讨论(0)
  • 2020-12-08 11:07

    looking at your error message first of all I would suggest you to recompile your whole application, make sure all the required dlls are there in bin folder when you recompile it.

    0 讨论(0)
  • 2020-12-08 11:11

    In my case my request object inherited from base object. Without knowingly I added a property with int? in my request object and my base object also has same property ( same name ) with int datatype. I noticed this and deleted the property which I added in request object and after that it worked fine.

    0 讨论(0)
  • 2020-12-08 11:17

    From that error, I would say that your code is fine, at least the part that calls the webservice. The error seems to be in the actual web service.

    To get the error from the web server, add a try catch and catch a WebException. A WebException has a property called Response which is a HttpResponse. you can then log anything that is returned, and upload you code. Check back later in the logs and see what is actually being returned.

    0 讨论(0)
提交回复
热议问题