Therest 4.5 error 500

Answered

Comments

28 comments

  • Avatar
    Anton Venema

    Hey Rodrigo!

    If you turn on detailed logging in IIS, you can get a better look at the exact error causing the 500.

    What happens if you open the NET.Server example in VS2012, change the target framework to .NET 4.5, and run it?

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    Used in 3.5 and 4.5 and appeared :

    Request failed.

    JSONP request timed out.

    There is another message when I type in the url:

    Exception: quality '8' is outside the permissible range of 0 to 1 (inclusive).

    I will try to test this on another machine.

    and iis.

    thanks

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    Very strange. It opens and runs fine over here. If you can package up and send over the solution, we'll be happy to look at it and attempt to unravel this mystery.

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    tested  the NET.Server example( default version 3.5) in VS2012 and in VS2010 on a machine windows 7 ultimate pro and machine windows 8 pro.

    result:

    Request failed.

    JSONP request timed out.

    I have a version 2.1.4.0 of the files in a project that works.

    I downloaded the version 2.3.1.0 yesterday, tested and gave error.

    I will send.

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    You're not going to like me for saying this, but the solution you sent opened and ran perfectly over here:

    Input: Hello, this is TheRest.

    Output: Uryyb, guvf vf GurErfg.

     

    Input: Uryyb, guvf vf GurErfg.

    Output: Hello, this is TheRest.

     

    The NET.Server project uses port 2000 on the local VS web server. Is it possible you have something else using port 2000?

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    the strange thing is that when I type http://localhost:2000/therest.ashx in url appears:

    TheRest is active:

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    Open the debugging tools in Chrome/Firefox and watch the network requests. Are they going to http://localhost:2000/therest.ashx?

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

     window 8 Attach file (img1.jpg)

    windows 7 Attach file (img2.jpg)

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    window 8 Attach file (img1.jpg)

    windows 7 Attach file (img2.jpg)

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    Sorry, I meant open the JavaScript.Client example and look at the network requests.

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    Attach javascript client network requests 

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    It looks like your server, for whatever reason, doesn't support CORS requests (even though the OPTIONS request succeeded...). Try disabling CORS on the client-side:

    client.setDisableCORS(true);

    http://docs.frozenmountain.com/therest2/index.html#class=therest-getting-started-platform-considerations-30_javascript

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    Friend put the code client.setDisableCORS (true) and the error continued. I removed this code.

    I decided to test in other browsers ,I was only testing only in chrome Versão 27.0.1453.116 m

    tested  the NET.Server example

    results: 

    chrome 27.0 windows 8 - ERROR(Request failed status code 500)

    internet explorer10 WINDOWS 8 - Success (Input: Hello, this is TheRest.Output: Uryyb, guvf vf GurErfg)

    internet explorer8 WINDOWS 7 - Success (Input: Hello, this is TheRest.Output: Uryyb, guvf vf GurErfg)

    chrome 27.0 WINDOWS 7 - ERROR (Request failed status code 500)

    mozila WINDOWS 7 - ERROR (Request failed status code 500)

    thanks

     

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    Status code 500 is a server error. Doesn't make sense that a server error would depend on the browser.

    When you see the 500 in the Chrome developer tools, can you expand it out to see any more detail? Can you copy the request URL and open it in a new tab?

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    url:   http://localhost:2000/therest.ashx/rot13/?src=js&AspxAutoDetectCookieSupport=1&_cb=1372880927990

    message:      "Could not process request. (Exception: quality '8' is outside the permissible range of 0 to 1 (inclusive).)"

     

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    OK, what do you see if you select the request in the developer tools (headers, specifically)?

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    Attach file

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    in view source:

    1. HTTP/1.1 500 Internal Server Error Server: ASP.NET Development Server/11.0.0.0 Date: Wed, 03 Jul 2013 20:26:17 GMT X-AspNet-Version: 2.0.50727 Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 109 Connection: Close
    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    Very strange. I tried replicating an HTTP request using the exact same headers as your example, but it still succeeds over here. Here's the trace output from my attempt in case you see something I missed:

    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

    Accept-Encoding: gzip,deflate,sdch

    Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4

    Cache-Control: max-age=0

    User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36

    Host: localhost:2000

    Connection: Keep-Alive

    Can you copy/paste the entire Request Headers section so I can make sure I've included any whitespace, etc.?

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    GET /therest.ashx/rot13/?src=js&AspxAutoDetectCookieSupport=1&_cb=1372886412486 HTTP/1.1

    Host: localhost:2000

    Connection: keep-alive

    Cache-Control: max-age=0

    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

    User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36

    Accept-Encoding: gzip,deflate,sdch

    Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4

    Cookie: ASP.NET_SessionId=tn1wx4l0tjurf2n0b4bqm1d4

     

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    Nope, still succeeding over here. I'm testing using the following code in a simple Console Application. If you run the same code (changing localhost:1291 to the port for your web server) on your end, do you get a 500?

     

                var request = (HttpWebRequest)WebRequest.Create("http://localhost:1291/therest.ashx/rot13/");

                request.Method = "POST";

                request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";

                request.Headers["Accept-Encoding"] = "gzip,deflate,sdch";

                request.Headers["Accept-Language"] = "pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4";

                request.Headers["Cache-Control"] = "max-age=0";

                request.KeepAlive = true;

                request.Host = "localhost:2000";

                request.UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36";

     

                try

                {

                    using (var requestStream = request.GetRequestStream())

                    {

                        using (var sw = new StreamWriter(requestStream))

                        {

                            sw.Write(@"{""text"":""Testing.""}");

                        }

                    }

     

                    using (var response = request.GetResponse())

                    {

                        using (var responseStream = response.GetResponseStream())

                        {

                            using (var sr = new StreamReader(responseStream))

                            {

                                Console.WriteLine(sr.ReadToEnd());

                            }

                        }

                    }

                }

                catch (WebException wex)

                {

                    Console.WriteLine("Exception!");

     

                    if (wex.Response != null)

                    {

                        using (var responseStream = wex.Response.GetResponseStream())

                        {

                            using (var sr = new StreamReader(responseStream))

                            {

                                Console.WriteLine(sr.ReadToEnd());

                            }

                        }

                    }

                }

     

                Console.WriteLine("All done. Press any key to exit...");

                Console.ReadKey(false);

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    localhost:1291

     

    GET /therest.ashx/rot13/?src=js&AspxAutoDetectCookieSupport=1&_cb=1372888480828 HTTP/1.1

    Host: localhost:1291

    Connection: keep-alive

    Cache-Control: max-age=0

    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

    User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36

    Accept-Encoding: gzip,deflate,sdch

    Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4

    Cookie: ASP.NET_SessionId=tn1wx4l0tjurf2n0b4bqm1d4

     

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    Did you mean to post the results of the console application test?

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    Hi friend used this code that you indicated: put the request google chrome and gave error.

    put the request  internet explorer and it worked.

    I did a little fusion of the request with the google chrome internet explorer. single field that was changed.I. used every request google chrome and changed

    google chrome:  request.Headers["Accept-Language"] ="pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4"

    by

    internet explorer: request.Headers["Accept-Language"] ="pt-BR"

    worked.

    see with their own eyes

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    Interesting! I'm betting there's a .NET culture/language setting that's somehow affecting how we are parsing the q fields in the AcceptEncoding header.

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    Yep, I can reproduce the problem by explicitly changing the server culture to pt-BR by adding the following to web.config under <system.web>

    <globalization culture="pt-BR" />

    The July release is going out this week, and we'll be sure to have a fix in place for it. Temporarily, you can probably resolve the issue by explicitly setting the culture to en-US in web.config under <system.web>:

    <globalization culture="en-US" />

    0
    Comment actions Permalink
  • Avatar
    rodrigo nunes

    everything worked

    very grateful. thank you very much.

    0
    Comment actions Permalink
  • Avatar
    Anton Venema

    Hey Rodrigo,

    Just FYI, this was fixed permanently in the latest release. No need to set the globalization culture :)

    Cheers,

    Anton

    0
    Comment actions Permalink

Please sign in to leave a comment.