Priviledge Required Visual Studio 2008 Impersonate Error Access Denied

My problem is with impersonation running on my development PC.  When I run with a domain user and password I get;
1. "There were build errors. Would you like to continue and run the last successful build?"
2. "Unable to start program 'http://localhost:49358/WebSitePath'. A required privilege is not held by the client."
3.  Error: "Failed to start monitoring changes to '\\WebServerName\WebSitePath\global.asax' because access is denied"

The funny thing is I don't have a global.asax file.  Of course I made one but I still got the error.

So far I have tried the following advice from the sites below to no avail:
1.  Followed the instructions in the following for both Development PC and servers where applicable:
    a.  http://technet.microsoft.com/en-us/library/2xzyzb0f(VS.80,printer).aspx
    b.  http://msdn2.microsoft.com/en-us/library/aa984236(VS.71,printer).aspx
    c.  http://support.microsoft.com/kb/315158
    d.  http://support.microsoft.com/default.aspx?scid=kb;en-us;Q306158
    e.  http://msdn2.microsoft.com/en-us/library/aa984235(VS.71,printer).aspx
    f.  http://msdn2.microsoft.com/en-us/library/aa719568(VS.71,printer).aspx
    g.  http://msdn2.microsoft.com/en-us/library/aa984237(VS.71,printer).aspx
    h.  http://support.microsoft.com/kb/317012/
    i.  http://blog.devstone.com/Aaron/archive/2004/12/03/359.aspx
    j.  Run this command C:\>CACLS %WINDIR%\assembly /e /t /p domain\uASP:R

2.  Try giving domain\uASP the highest permissions possible on all Servers and Development PC.

I still get the error.  It is driving me crazy as I have spent 10 hours on trying everything.  It seems as if the virtual folder of the VS 2008 Web Server doesn't have permissions.  I can't change any of these since it doesn't exist until run time.

By the way, if I access the website through IE it works fine.  I just need the VS stuff to run correctly for development and debugging.
   

Development PC:
Model: Dell Precision 490 (latest BIOS, etc.)
Os: Vista Ultimate (latest service packs)
Software: Visual Studio 2008 Professional

Web Server:
Model: Dell PowerEdge 2850
OS: Windows Server 2003 SP2

Database Server:
Datebase: SQL Server 2005 (latest service packs)

Microsoft .NET 3.5 installed

This what I have in web.config:

<connectionStrings>
   <add name="dbName" connectionString="Data Source=dataServerName\DBEngineName; Initial Catalog=DatabaseName; Integrated Security=SSPI"/>
</connectionStrings>
.
.
.
<identity impersonate="true" userName="domain\uASP" password="ihateMS"/>

If I change the identity line above to:
<identity impersonate="true"/>
I don't get the error because obviously it is running as the logged on user.


Here is the code from Default.aspx (very basic):

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <p>
        This is the server</p>
    <div>
   
    </div>
    <asp:Label ID="lblInfo" runat="server" Text="Label"></asp:Label>
    </form>
</body>
</html>
//Here is the code from my Default.aspx.cs file (it is very simple test to the database):
 
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Configuration;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
 
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // Create the Connection object.
        string connectionString = WebConfigurationManager.ConnectionStrings["db01"].ConnectionString;
        SqlConnection con = new SqlConnection(connectionString);
 
        try
        {
            // Try to open the connection.
            con.Open();
            lblInfo.Text = "<b>Server Version:</b> " + con.ServerVersion;
            lblInfo.Text += "<br /><b>Connection Is:</b> " + con.State.ToString();
        }
        catch (Exception err)
        {
            // Handle an error by displaying the information.
            lblInfo.Text = "Error reading the database. " + err.Message;
        }
        finally
        {
            // Either way, make sure the connection is properly closed.
            // Even if the connection wasn't opened successfully,
            // calling Close() won't cause an error.
            con.Close();
            lblInfo.Text += "<br /><b>Now Connection Is:</b> " +
            con.State.ToString();
        }
    }
}

Open in new window

ascndAsked:
Who is Participating?
 
ascndConnect With a Mentor Author Commented:
Okay I solved this one myself.  I hope this helps anyone else that comes across this problem.  As I did before and to cut out all the BS of assigning ACL permisions to separte folders I just assigned domain\uASP to the local administrators group to test my theory.  I did that before and it didn't work by just doing that.  So, when I got it to work on my XP machine just by assigning to domain\uASP to the local administrators group I knew it the problem was some part of Vista's new security blocking.  Well here is the solution:

Run Visual Studio 2008  as an administrator.  That is, on the shortcut for Visual Studio 2008 right click it and then select the "Run As Administrator" option.  That did it!  Geez, what a pain the tush!  If anyone else wants to share any comments about this please feel free.  I also wouldn't mind feedback from you if this helped you.
0
 
ascndAuthor Commented:
Here is the Application Event 1334 I keep getting:

User:          N/A
Computer:      DevPC.Domain.local
Description:
The description for Event ID 1334 from source ASP.NET 2.0.50727.0 cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

Failed to initialize the AppDomain:88108216

Exception: System.Web.HttpException

Message: Failed to start monitoring changes to '\\WebServerName\WebSitePath\global.asax' because access is denied.

StackTrace:    at System.Web.Compilation.BuildManager.ReportTopLevelCompilationException()
   at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters)
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters)
   at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
   at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)

InnerException: System.Web.HttpException

Message: Failed to start monitoring changes to '\\WebServerName\WebSitePath\global.asax' because access is denied.

StackTrace:    at System.Web.DirectoryMonitor.AddFileMonitor(String file)
   at System.Web.DirectoryMonitor.StartMonitoringFile(String file, FileChangeEventHandler callback, String alias)
   at System.Web.FileChangesMonitor.StartMonitoringFile(String alias, FileChangeEventHandler callback)
   at System.Web.HttpApplicationFactory.SetupChangesMonitor()
   at System.Web.HttpApplicationFactory.Init()
   at System.Web.HttpApplicationFactory.EnsureInited()
   at System.Web.Compilation.BuildManager.CompileGlobalAsax()
   at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()

Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="ASP.NET 2.0.50727.0" />
    <EventID Qualifiers="49152">1334</EventID>
    <Level>2</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2008-02-09T05:52:30.000Z" />
    <EventRecordID>3504</EventRecordID>
    <Channel>Application</Channel>
    <Computer>NEOHDT01.ASCND.local</Computer>
    <Security />
  </System>
  <EventData>
    <Data>Failed to initialize the AppDomain:88108216

Exception: System.Web.HttpException

Message: Failed to start monitoring changes to '\\WebServerName\WebSitePath\global.asax' because access is denied.

StackTrace:    at System.Web.Compilation.BuildManager.ReportTopLevelCompilationException()
   at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters)
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters)
   at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
   at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)

InnerException: System.Web.HttpException

Message: Failed to start monitoring changes to '\\WebServerName\WebSitePath\global.asax' because access is denied.

StackTrace:    at System.Web.DirectoryMonitor.AddFileMonitor(String file)
   at System.Web.DirectoryMonitor.StartMonitoringFile(String file, FileChangeEventHandler callback, String alias)
   at System.Web.FileChangesMonitor.StartMonitoringFile(String alias, FileChangeEventHandler callback)
   at System.Web.HttpApplicationFactory.SetupChangesMonitor()
   at System.Web.HttpApplicationFactory.Init()
   at System.Web.HttpApplicationFactory.EnsureInited()
   at System.Web.Compilation.BuildManager.CompileGlobalAsax()
   at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()</Data>
  </EventData>
</Event>
0
 
ascndAuthor Commented:
Latest update.  I have installed VS Pro 2008 on a XP machine.  I added my domain\uASP user to the local adminstrators group and then ran it.  It worked with no problems!  My errors must have something to do with Vista's security.  Anybody out there???
0
All Courses

From novice to tech pro — start learning today.