1

I am intending to run jQuery and AJAX with ASP.NET 3.5. On the Visual Studio development server (Cassini), the call to the .aspx page is too slow. It takes about 30 sec. Then, it stops at the break point if I debug and it returns the JSON with date as well. However, the same code published to an IIS web site runs well and runs fast.

Environment: (Windows Vista 64 + Visual Studio 2008)

ASPX page

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Calling a page method with jQuery</title>
<script type="text/javascript" src="Scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="Scripts/Default.js"></script>
</head>
<body>
<div id="Result">Click here for the time.</div>
</body>
</html>

file - Scripts/Default.js

$(document).ready(function() {
// Add the page method call as an onclick handler for the div.
$("#Result").click(function() {
    $.ajax({
        type: "POST",
        url: "Default.aspx/GetDate",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            // Replace the div's content with the page method's return.
            $("#Result").text(msg.d);
        }
    });
});
});

file - Default.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;


public partial class _Default : System.Web.UI.Page 

{

    [WebMethod]
    public static string GetDate()
    {
        return DateTime.Now.ToString();
    }
}

1 Answer 1

3

It's normal if you compile and run the application the first time. IIS will have to compile the application and put it in is cache. This happens the first time only. If you access the same page without debug, it shouldn't take that long. Every other request to the same page should be fast, after the first time.

You should chek with Precompilation of ASP.NET

Check if you have symbols in cache

Slow loading in debug

Sign up to request clarification or add additional context in comments.

1 Comment

No, in iis the first and next call is too fast (1 sec) but in Development Server is about (30 sec) every time and without debug (IE, Firefox 3). And in Firefox 3 in iss publish site run dont work...( but in IE 8 yes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.