Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8974267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:38:37+00:00 2026-06-15T18:38:37+00:00

I have a problem with my MVC3 Application on the prod server (I don’t

  • 0

I have a problem with my MVC3 Application on the prod server (I don’t have any problem in VS12).

  • jQuery 1.8.2
  • AutoFaq
  • Repository Pattern
  • log4net
  • AutoMapper

The application has in the _Layout.cshtml some lists which has to be updated every 5 seconds via jQuery.

The code looks more or less like this:

<script type="text/javascript">
    var products = $("#products ul");

    function updateProducts() {
        setTimeout(function() {
            $.post("/Product/List", { rows: 10 }, function(html) {
                products.before(html).remove();
                products = $("#products ul");

                // To avoid multiple posts update the list until the post is done
                updateProducts();
            });
        }, 5000);
</script>

And the Controller looks like this:

public PartialViewResult List(int rows)
{
    var products = productService.GetNewest(rows);
    return PartialView(products);
}

The Service looks like this:

public class ProductService : Service<Product>, IProductService
{
    private IRepository<Product> repository;

    public ProductService(IUnitOfWorkFactory unitOfWorkFactory)
    {
        IUnitOfWork unitOfWork = unitOfWorkFactory.Create();
        this.repository = unitOfWork.ProductRepository();
        base.Repository = this.repository;
        base.UnitOfWork = unitOfWork;
    }
}

public List<Product> GetNewest(int rows)
{
    var products = repository.GetAllQueryable(); //=> returns a IQueryable
    products.OrderBy(o => o.CreateDate).Take(rows);

    return products.ToList();
}

Repository (EF 5.0 code first):

public class Repository<T> : IRepository<T> where T : Base
{
    private RepositoryContext _dataContext;
    private IDbSet<T> _dbset;

    public virtual IQueryable<T> GetAllQueryable()
    {
        var all = _dbset;
        return all;
    }
}

UnitOfWork:

public class UnitOfWork : Disposable, IUnitOfWork
{
    private RepositoryContext _dataContext;
    private Repository<Product> _productRepository;

    public IUnitOfWork GetCurrent()
    {
        _dataContext = _dataContext ?? (_dataContext = new RepositoryContext());

        return this;
    }

    public IRepository<Product> ProductRepository()
    {
        _productRepository = _productRepository ?? new Repository<Product>(_dataContext);

        return _productRepository;
    }
}

And the partial view contains only a foreach which returns the product name.

Even if I have only one list which has to be updated, the page loads getting slower and it’s randomly. I also use log4net to check if something happens when jQuery tries to get the products, but the Logs are empty :).

I also investigate the problem with MiniProfiler. The slowest thing (up to 15s) is the ASP.NET Begin Request.

Prod Server:

  • Windows 2008
  • 3GB Ram
  • 2 other .NET Applications
  • SQL08

EDIT

It seems the problem is fixed, YAY! Thanks to @vtortola for the hint with the Session. I did some research and found good links. Then I created a new Controller which has [SessionState(SessionStateBehavior.ReadOnly)] on it. And that’s it, an attribute solved my problem :)!

Here is a helpfull link, especially when you want a SessionStateBehavior like ReadAndWrite
http://www.davidcoombes.co/?p=151

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:38:38+00:00Added an answer on June 15, 2026 at 6:38 pm

    How many lists do you update at the time? The session object uses a pesimisctic concurrency approach, what means that only one request can be processed at the time for the same session. If you are doing multiple requests in parallel, try to disable session in that controller, or make the session read only. Take a look at the SessionStateAttribute.

    Cheers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a problem with my mvc3 application, i need to create some Validation
I have a problem with a model in a asp.net mvc3 application. First of
My Problem: I have an MVC3 application where all views use a common master
I have hosted my asp .net mvc3 application in iis server 7. I had
I have strange problem with an MVC3 application. The application works as expected on
I have problem with cache in my asp.net mvc3 application. My code using System.Web.Caching;
I have problem with my web application. I am using MVC3 and not so
I have an MVC3 application doing AJAX edit of a grid line using JQUERY
I have problem with create ulr routing for asp.net mvc3 application. My project has
I have a problem with the user Login and Logout in an MVC3 application.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.