"拒绝访问"当试图连接到远程IIS服务器 - C# [英] "Access Denied" when trying to connect to remote IIS server - C#

查看:313
本文介绍了"拒绝访问"当试图连接到远程IIS服务器 - C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到访问Deined收到COMException当我尝试连接到从我的C#应用​​程序时IIS 5.1下运行的远程IIS 6服务器。

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.

任何想法?我遇到的所有与原问题相同的问题。

Any ideas? I am experiencing all the same issues with the original questions.

更新 - 09年4月1日

我发现这个解决方案( HTTP://www.$c$cproject .COM / KB / CS / Start_Stop_IIS_Website.aspx ),由连接到IIS服务器启动和停止网站的窗口应用程序。我能到我的工作站上运行,并连接到IIS服务器。

I found this solution (http://www.codeproject.com/KB/cs/Start_Stop_IIS_Website.aspx) 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.

唉....我为什么可以运行此独立的应用程序,但不是我的ASP.NET应用程序?

Ugh....why can I run this stand alone application but not my ASP.NET application?

原始

我收到访问被拒绝收到COMException当我尝试使用DirectoryEntry.Exist方法来检查,看是否IIS服务器是有效的从远程计算机连接到IIS。

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.

string path = string.Format("IIS://{0}/W3SVC", server);

if(DirectoryEntry.Exist(path))
{
    //do something is valid....
}

我已经被添加到Administrators组,我试图连接到IIS服务器的Active Directory组的成员。

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.

有没有人遇到此问题,并知道如何解决它?

Has anyone experience this issue and know how to resolve it?

更新:

@Kev - 这是一个ASP.NET应用程序。另外,我可以连接而无需通过IIS6管理器中的远程服务器的用户名和密码。

@Kev - It is an ASP.NET application. Also, I can connect without an username and password to the remote server through IIS6 Manager.

@克里斯 - 我试图连接到远程服务器,以显示虚拟directorys的数量和确定的每个目录的.NET framework版本。见<一href=\"http://stackoverflow.com/questions/636569/how-do-i-determine-the-asp-net-version-of-a-virtual-directory-or-website-using-c\">this SO问题。

@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 this SO question.

@dautzenb - 我的ASP.NET应用程序IIS 5.1下运行尝试连接到IIS 6服务器。我可以看到在安全日志中的远程服务器上我的本地ASPNET帐户故障审核。当我尝试调试应用程序,我在我的域帐户下运行,仍然得到了访问被拒绝。

@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.

更新2:

@Kev - 我是能够建立使用以下过载创建一个DirectoryEntry对象:

@Kev - I was able to establish to create a DirectoryEntry object using the following overload:

public DirectoryEntry
(    
    string path,    
    string username,    
    string password
)

不过,所有属性包含一个扔System.Runtime.InteropServices.COMException类型的异常,而我调试的应用程序。

But, all of the properties contain a " threw an exception of type 'System.Runtime.InteropServices.COMException'" while I debug the app.

此外,AuthenticationType属性设置为安全。

Also, the AuthenticationType property is set to Secure.

更新3:

下面的两个失败审核条目是在远程IIS服务器的安全事件日志每次我试图建立连接时间:

The following two failure audit entries were in the remote IIS server's security event log every time I tried to establish a connection:

第一个事件:

事件类别:帐户登录

事件ID:680

通过登录尝试:MICROSOFT_AUTHENTICATION_PACKAGE_V1_0

登录帐户:ASPNET

源工作站:

错误code:0xC0000234

Event Category: Account Logon
Event ID: 680
Log attempt by: MICROSOFT_AUTHENTICATION_PACKAGE_V1_0
Logon account: ASPNET
Source Workstation:
Error Code: 0xC0000234

第二个事件:

事件类别:登录/注销

事件ID:529

登录失败:

原因:未知的用户名或密码错误

用户名:ASPNET

域:(MYDOMAIN)

登录类型:3

登录进程:NtLmSsp

身份验证数据包:NTLM

工作站名称:(MyWorkstationId)

调用方用户名: -

调用方域: -

方登录ID: -

来电进程ID: -

传递服务: -

源网络地址:10.12.13.35

源端口:1708

Event Category: Logon/Logoff
Event ID: 529
Logon Failure:
Reason: Unknown user name or bad password
User Name: ASPNET
Domain: (MyDomain)
Logon Type: 3
Logon Process: NtLmSsp
Authentication Package: NTLM
Workstation Name: (MyWorkstationId)
Caller User Name: -
Caller Domain: -
Caller Logon ID: -
Caller Process ID: -
Transited Services: -
Source Network Address: 10.12.13.35
Source Port: 1708

模拟设置为true,并且用户名和密码都为空。它使用的是远程IIS服务器上的ASPNET帐户。

Impersonation is set to true and the username and password are blank. It is using the ASPNET account on the remote IIS server.

推荐答案

如果它是一个身份的问题,你可以尝试设置你的IIS 5.1的应用程序使用<一个href=\"http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/5f8fe119-4095-4094-bba5-7dec361c7afe.mspx?mfr=true\"相对=nofollow>集成Windows身份验证,然后将以下添加到您在IIS5.1网站的Web.config下的System.Web启用的模拟

If it is an identity problem, you could try setting your IIS 5.1 application to use Integrated Windows Authentication, and then add the following to you web.config on your IIS5.1 web site under system.web to enable impersonation.

<identity impersonate="true"/>
<authentication mode="Windows" />

这篇关于&QUOT;拒绝访问&QUOT;当试图连接到远程IIS服务器 - C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆