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 619753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:41:22+00:00 2026-05-13T18:41:22+00:00

I’ve got a linq query, which is admittedly pretty large. I can’t identify where

  • 0

I’ve got a linq query, which is admittedly pretty large. I can’t identify where it is going wrong because it ONLY happens on the remote server and I don’t have the access to debug it. But it is basically like this…

This code lists all of the ‘folders’ that the current member can see. (Folders contain images.)

            if (membership == null || membership.Count() == 0)
                membership = new string[] { "Guests" };

            return DataContext.Folders.Where(f => f.Ring.Keys.Any(k => k.Tag.Id == id))
                .Where(i => i.Ring.Keys.Any(t => membership.Contains(t.Tag.Name))).OrderBy(n => n.Date).DefaultIfEmpty();

This code lists all of the ‘tags’ the user can see (tags are contained in rings, which can be hooked onto folders or images)

        IQueryable<Models.Tag> tags = null;
        do
        {
            DataContext = new Models.Contexts.DatabaseDataContext();

            tags = null;
            if (membership == null)
                membership = new string[] { "Guests" };

            tags = DataContext.Tags.Where(t => t.Keys.Any(k => k.Ring.Name == category))
                .Where(t => t.Keys.Any(k => k.Ring.Keys.Any(c => membership.Contains(c.Tag.Name)))).OrderBy(o => o.Name);
        }
        while (tags == null || tags.Count() == 0);

        return tags;

I enclosed it in a do loop, much to my dismay, to see if it could force it to actually keep calling until it was no longer null. No such luck, It still comes back empty. Again, this EXACT same code works ‘sometimes’, and 100% of the time on EVERY test back, querying the SAME database. I have even tried different web hosts – all with the same failures once it is live.

membership is a string[] that contains a list of all of the roles the member belongs to.

Folder
- Id
- RingId

Ring
- Id
- Name (Nullable)

Tag
- Id
- Name

Key
- Id
- RingId
- TagId

Image
- Id
- FolderId
- RingId

This is the basic database structure setup.

Now, this query runs fine on my local machine – in all of my tests, etc. But when I put it live, it just randomly starts returning null sometimes. I cannot find a rhyme or a reason to why, it runs fine for a few requests, then it just stops returning the results.

The result set it returns is pretty large. I’d say about 880 items. And the amount of times it is accessed per second is very, very high. I thought at first maybe it was just the stress of how many people were accessing it.

Is there any information I can provide that might help in debugging this? There are a few other queries similar to this one – I have tried, and tried, and tried, and I simply cannot reproduce the results in a debugger. I am getting all sorts of InvalidCastException calls – but there’s never any casting. Everything is being returned as IQueryable – The views do not do anything special except take in Guids and pass the Membership data from the ASP.NET Membership Provider – which I’ve checked for and confirmed that it is working. (Inserted forced data, instead of letting the provider do it – still fails)

I will try to provide any information needed, but I am really getting frustrated – as none of this is making sense to me (why it would be failing).

Thank you very much for your time. (This is all done in .NET 3.5, ASP.NET MVC 1.0, C# ) – the objects were created using LINQ to SQL.

  • 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-05-13T18:41:22+00:00Added an answer on May 13, 2026 at 6:41 pm

    This really sounds like a load issue. Put some perf counters on the web server and watch it for usage.

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

Sidebar

Related Questions

No related questions found

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.