ASP.NET 1.0核心,模拟 [英] ASP.NET CORE 1.0, Impersonation

查看:243
本文介绍了ASP.NET 1.0核心,模拟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的Intranet应用。在project.json目标框架是dnx451。
这是我发布命令:

I'm writing an Intranet application. Target framework in project.json is dnx451. That's my publishing command:

dnu publish --runtime dnx-clr-win-x86.1.0.0-rc1-update1 --no-source

数据库连接字符串:

Server=name;Database=name;Trusted_Connection=True;



我试图冒充数据库访问,但它不工作。当我开始申请我的Windows用户的认可和它放在右上角Domain\Username说你好。当我尝试访问我的错误数据库用户登录失败Domain\Computername。如果我在我的用户下运行的应用程序池,然后一切工作正常。

I'm trying to impersonate the database access but it's not working. When I start the application my windows user is recognized and it says Hello, Domain\Username on top right. As soon as I try to access the database I get the error "Login failed for user Domain\Computername". If I run the application pool under my user then everything works fine.

IIS:
.NET CLR Versio是V4.0,管理Pipline模式经典和身份是ApplicationPoolIdentity。
网站认证:ASP.NET模拟和Windows身份验证启用

IIS: .NET CLR Versio is v4.0, Managed Pipline Mode Classic and Identity is ApplicationPoolIdentity. Website authentications: ASP.NET Impersonation and Windows Authentication are enabled.

什么我需要改变这种模拟终于工作

What do I need to change that impersonation is finally working?

推荐答案

核心并不支持模拟,因为所有的网页代码是出于PROC的,由红隼主办。如果你想做到这一点,你需要采取的现任校长,作为一个WindowsPrincipal,然后手动模仿在您需要的地步。

Core does not support impersonation because all web code is out of proc, hosted by Kestrel. If you want to do it you need to take the current Principal, as a WindowsPrincipal, then manually impersonate at the point where you need it.

有一点需要注意的是,在RC1你没有得到一个WindowsPrincipal,所以你现在不能这样做的权利。它会固定在RC2。

One thing to note is that in RC1 you don't get a WindowsPrincipal, so you can't do this right now. It'll be fixed in RC2.

这篇关于ASP.NET 1.0核心,模拟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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