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

  • SEARCH
  • Home
  • 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 9208225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:34:17+00:00 2026-06-18T00:34:17+00:00

About once a day or two now my web site starts throwing and error

  • 0

About once a day or two now my web site starts throwing and error when people try to login and no one can log in until I restart IIS. How can Any() do this and what can I do to fix it?

Here’s the function throwing the exception:

        public override bool ValidateUser(string username, string password)
    {
        var db = Access.Context;
        var query =
            from p in db.Players
            where p.PlayerName == username
                && p.Password == password 
            select p
        ;
        return query.Any();
    }

Other LINQ to SQL queries work fine. Here’s the stack trace.

InvalidOperationException: Sequence contains no elements 

   System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) +1151
    System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) +113
    System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +344
    System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute(Expression expression) +23
    System.Linq.Queryable.Any(IQueryable`1 source) +243
    FortyTwoAccess.PlayerProvider.ValidateUser(String username, String password) in C:\dev\FortyTwo\FortyTwoAccess\PlayerProvider.cs:114
    FortyTwoClient.Models.AccountMembershipService.ValidateUser(String userName, String password) in C:\dev\FortyTwo\FortyTwoClient\Models\AccountModels.cs:117
    FortyTwoClient.Controllers.AccountController.LogOn(LogOnModel model, String returnUrl) in C:\dev\FortyTwo\FortyTwoClient\Controllers\AccountController.cs:42
    lambda_method(Closure , ControllerBase , Object[] ) +157
    System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
  • 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-18T00:34:18+00:00Added an answer on June 18, 2026 at 12:34 am

    The fix for this was to not use a class variable to save the context and instead instantiate the context locally in each method wrapped in a using.

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

Sidebar

Related Questions

I'm using the Exchange Web Services managed API and about once a day it
When you want to alert a user of something once (one time notes about
I have table where I track various statistics about site usage. Once a week,
There are two vb6 applications that I work with. One of them starts up
I'm archiving this web forum, which normally gets purged about once a week. So
My Visual Studio shuts down about once a day. Not gracefully either, it just
I have an Android Service that accesses the database about once per minute. Is
A large number of clients want to check in with a server about once
Once again a question about the garbage collector in actionscript-3: If I have a
I once worked on a C++ project that took about an hour and a

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.