Note that there are some explanatory texts on larger screens.

plurals
  1. PO"Access Denied" when trying to connect to remote IIS server - C#
    primarykey
    data
    text
    <p>I receive an "Access Deined" COMException when I try to connect to a remote IIS 6 server from my C# application that is running under IIS 5.1.</p> <p>Any ideas? I am experiencing all the same issues with the original questions.</p> <p><b>Update - 4/1/09</b></p> <p>I found this solution (<a href="http://www.codeproject.com/KB/cs/Start_Stop_IIS_Website.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs/Start_Stop_IIS_Website.aspx</a>) that consists of a window application connecting to an IIS server to start and stop web sites. I am able to run it on my workstation and connect to the IIS server.</p> <p>Ugh....why can I run this stand alone application but not my ASP.NET application?</p> <p><b>Original</b></p> <p>I receive an "Access Denied" COMException when I try to connect to IIS from a remote machine using the DirectoryEntry.Exist method to check to see if the IIS server is valid.</p> <pre><code>string path = string.Format("IIS://{0}/W3SVC", server); if(DirectoryEntry.Exist(path)) { //do something is valid.... } </code></pre> <p>I am a member of an active directory group that has been added to the Administrators groups to the IIS server I am trying to connect to.</p> <p>Has anyone experience this issue and know how to resolve it?</p> <p><b>UPDATE:</b> </p> <p>@Kev - It is an ASP.NET application. Also, I can connect without an username and password to the remote server through IIS6 Manager.</p> <p>@Chris - I am trying to connect to the remote server to display the number of virtual directorys and determine the .NET framework version of each directory. See <a href="https://stackoverflow.com/questions/636569/how-do-i-determine-the-asp-net-version-of-a-virtual-directory-or-website-using-c">this</a> SO question.</p> <p>@dautzenb - My ASP.NET application is running under IIS 5.1 trying to connect to an IIS 6 server. I can see fault audits in the security log for my local ASPNET account on the remote server. When I try to debug the application, I am running under my domain account and still get the Access is denied.</p> <p><b>UPDATE 2:</B></p> <p>@Kev - I was able to establish to create a DirectoryEntry object using the following overload:</p> <pre><code>public DirectoryEntry ( string path, string username, string password ) </code></pre> <p>But, all of the properties contain a " threw an exception of type 'System.Runtime.InteropServices.COMException'" while I debug the app.</p> <p>Also, the AuthenticationType property is set to Secure.</p> <p><b>UPDATE 3:</b></p> <p>The following two failure audit entries were in the remote IIS server's security event log every time I tried to establish a connection:</p> <p>First event:</p> <p>Event Category: Account Logon<br /> Event ID: 680<br /> Log attempt by: MICROSOFT_AUTHENTICATION_PACKAGE_V1_0<br /> Logon account: ASPNET<br /> Source Workstation: <br /> Error Code: 0xC0000234<br /></p> <p>Second event:</p> <p>Event Category: Logon/Logoff<br /> Event ID: 529<br /> Logon Failure:<br /> Reason: Unknown user name or bad password<br /> User Name: ASPNET<br /> Domain: (MyDomain)<br /> Logon Type: 3<br /> Logon Process: NtLmSsp<br /> Authentication Package: NTLM<br /> Workstation Name: (MyWorkstationId)<br /> Caller User Name: -<br /> Caller Domain: -<br /> Caller Logon ID: -<br /> Caller Process ID: -<br /> Transited Services: -<br /> Source Network Address: 10.12.13.35<br /> Source Port: 1708<br /></p> <p>Impersonation is set to true and the username and password are blank. It is using the ASPNET account on the remote IIS server.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload