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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:09:34+00:00 2026-05-15T01:09:34+00:00

Hello (this is a long post sorry), I am writing a application in ASP.NET

  • 0

Hello (this is a long post sorry),

I am writing a application in ASP.NET MVC 2 and I have reached a point where I am receiving this error when I connect remotely to my Server.

Failed to generate a user instance of SQL Server due to failure in retrieving the user’s local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

I thought I had worked around this problem locally, as I was getting this error in debug when site was redirected to a baseUrl if a subdomain was invalid using this code:

    protected override void Initialize(RequestContext requestContext)
    {
        string[] host = requestContext.HttpContext.Request.Headers["Host"].Split(':');

        _siteProvider.Initialise(host, LiveMeet.Properties.Settings.Default["baseUrl"].ToString());

        base.Initialize(requestContext);
    }

    protected override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        if (Site == null)
        {
            string[] host = filterContext.HttpContext.Request.Headers["Host"].Split(':');

            string newUrl;

            if (host.Length == 2)
                newUrl = "http://sample.local:" + host[1];
            else
                newUrl = "http://sample.local";

            Response.Redirect(newUrl, true);

        }

        ViewData["Site"] = Site;
        base.OnActionExecuting(filterContext);
    }
    public Site Site
    {
        get
        {
            return _siteProvider.GetCurrentSite();
        }
    }

The Site object is returned from a Provider named siteProvider, this does two checks, once against a database containing a list of all available subdomains, then if that fails to find a valid subdomain, or valid domain name, searches a memory cache of reserved domains, if that doesn’t hit then returns a baseUrl where all invalid domains are redirected.

locally this worked when I added the true to Response.Redirect, assuming a halting of the current execution and restarting the execution on the browser redirect.

What I have found in the stack trace is that the error is thrown on the second attempt to access the database.

    #region ISiteProvider Members

    public void Initialise(string[] host, string basehost)
    {
        if (host[0].Contains(basehost))
            host = host[0].Split('.');

        Site getSite = GetSites().WithDomain(host[0]);

        if (getSite == null)
        {
            sites.TryGetValue(host[0], out getSite);
        }

        _site = getSite;
    }

    public Site GetCurrentSite()
    {
        return _site;
    }

    public IQueryable<Site> GetSites()
    {
        return from p in _repository.groupDomains
               select new Site
               {
                   Host = p.domainName,
                   GroupGuid = (Guid)p.groupGuid,
                   IsSubDomain = p.isSubdomain
               };
    }

    #endregion

The Linq query ^^^ is hit first, with a filter of WithDomain, the error isn’t thrown till the WithDomain filter is attempted.

In summary: The error is hit after the page is redirected, so the first iteration is executing as expected (so permissions on the database are correct, user profiles etc) shortly after the redirect when it filters the database query for the possible domain/subdomain of current redirected page, it errors out.

  • 1 1 Answer
  • 2 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-15T01:09:35+00:00Added an answer on May 15, 2026 at 1:09 am

    Make sure App Pool is set to NetworkService if under windows 7 and IIS 7.5

    I searched long and hard for this one, it was my error all along. It seem that at sometime someone decided to change my applciationpool settings and changed the applicationpool for my application. But for some strange reason it didn’t impact me until I tried to use the redirection code.

    Before adding the code all databases connected without any issues and data was pulled without error, but afterwords it didn’t, so after looking at my appool, I noticed it was not set to networkservice any longer, switched, fixed.

    So maybe this question should be, why would database connections work before the new code, but not after while not under networdservice user?

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

Sidebar

Related Questions

I have done this: $ z() { echo 'hello world'; } How do I
This is the HTML: <div id=testBlue> <span>hello</span> <span id=testGreen class=testGreen>hello2</span> </div> If I have
How to get a file's creation date or file size, for example this Hello.jpg
Hello can anybody solve this please I'm creating the object in the action class
Hello I am working with a simulator that uses rcS scripts to boot, this
I'm trying something like this Output.py print Hello Input.py greeting = raw_input(Give me the
I wrote this function that's supposed to do StringPadRight("Hello", 10, "0") -> "Hello00000" .
Can any one explain why the output of this code is only 'hello' and
This has always confused me. It seems like this would be nicer: ["Hello", "world"].join("-")
I could do this in C#.. int number = 2; string str = Hello

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.