问题
I'm running this out of the VS 2008 debugger on Windows 7, running .Net 3.5.
The idea was to make all ajax requests with jQuery only, rather than .net, following some tutorials online.
Default.aspx -> HTML page, jquery triggers method in Default.aspx.cs
http://pastebin.com/pxBvKA2H
Default.aspx.cs -> C# Webform, just defines a GetDate function, which only returns a string for now (trying to eliminate any possible issues)
(can only post one hyperlink...) pastebin.com/pnHn50hu
The ajax query takes longer than it should. Profiling with firebug revealed that it took 1.03 ms.
1s DNS Lookup | 26ms Waiting | 1ms Receiving
EDIT: It continues to take the same set of times if you continue to click and resubmit the request.
Is there anything I can do to cut down on the DNS Lookup time / what did I do wrong?
回答1:
After you get site running in debug mode, change your URL in the browser from localhost:#### to 127.0.0.1:#### and see if that makes a difference. I found recently that it did.
回答2:
Is it only slow in Firefox? This sounds like the old IPv6 lookup problem that Firefox tends to suffer from.
If it's fast in IE, then follow these directions to turn off IPv6 lookups in firefox.
来源:https://stackoverflow.com/questions/2959746/dns-lookup-in-simple-c-asp-net-ajax-call-is-extremely-slow