English 中文(简体)
在MVC 3号申请中任命和派代表团
原标题:Impersonation and Delegation within a MVC 3 application on IIS 7.5

鉴于以下设想:

  • Windows 2008 R2 x64 web server with IIS 7.5, Server 1
  • Windows 2003 R2 x64 file server, Server 2
  • MVC 3 application with Windows authentication and impersonation (authenticated user)
  • Configured Server 1 as Trusted computer for delegation in Active directory
  • Internet Explorer 8

在申请中,用户有可能上载档案。 这一载荷必须在<>Server 2上保存。 在《法典》中,我们开辟了通往Server 2的道路,并拯救了这条道路。

public ActionResult Upload(HttpPostedFileBase file)
{
  var savedDirectory = "\PathToServer2";

  if (Directory.Exists(savedDirectory))
  {
    file.SaveAs(savedFileName);
  }
  else
  {
    Directory.CreateDirectory(savedDirectory);
    file.SaveAs(savedFileName);
  }

  return RedirectToAction("Action", "Controller", new { id = 1 });
}

We installed the application on Server 1 and test it locally on Server 1, everything went fine. Files are uploaded to Server 2 no issues there.

When we test the same scenario from a client desktop we get an error saying that there is not enough permissions to save the file on Server 2.

一次丝网会议向我们展示了Server 1 <>/strong> 并非冒犯,因为在上认证用户。 服务器2是空的/匿名的。

Impersonation as Specific User instead of Authenticated User

我们没有获得假冒服务,因此我们设立了一个服务账户,并配置了与这一条相容的申请:<代码>特定用户<>代码/代码>,而不是<编码>用户<>。 该服务账户是个域账户,在上有印本许可。

当我们试图上载时,服务账户没有当地文件夹的许可,我们从那里卸下文件。

Delegation

我们通过,通过p.net mvc了解,我们需要为代表团信任Server 1

After we trusted Server 1 for delegation: still no permissions to save the file on Server 2. We tried this both with impersonation as Authenticated User en Specific user

  1. Impersonation as Authenticated User with delegation not working: not enough permissions on Server 2
  2. Impersonation as Specific User not working: not enough permissions on the Local folder

Do we miss something here? Do we need extra steps for delegation?

最佳回答

我们通过:

  1. Configuring delegation on the domain for Server 1
  2. And adding Kerberos provider to the Application within IIS (right click on Windows Authentication)
问题回答

我今天碰到了这一错误,这里是我为解决这个问题而采取的步骤:

  1. Make sure that ASP.NET Impersonation is enabled for your site. Go to your site in IIS Manager and under features double click on Authentication then enable ASP.NET Impersonation
  2. Use Integrated mode for your app pool
  3. 您的申请网页。 专栏:

    <system.webServer>
      <validation validateIntegratedModeConfiguration="false" />
      <modules runAllManagedModulesForAllRequests="true" /> 
    </system.webServer>
    




相关问题
Validate NT User via SQL CLR

I need to be able to validate a given username and password against Active Directory and return whether that user exists. My setup is that I have two web servers in a DMZ, and then a SQL Server in ...

Impersonating user with Entity Framework

So we have our web app up and going with entity framework. What we d like to do is impersonate the current user when we re accessing the DB. We re not interested in setting impersonation up in our ...

Why is a published website referencing my machine?

I have a website that I publish in Visual Studio 2008 and then send off to other people. One of the pages needs to alter a few configuration files, so an action is executed using ...