【发布时间】:2017-06-02 22:09:55
【问题描述】:
我需要查询 ActiveDirectory 以让用户选择名称并添加到他们正在保存的记录中。除了设置要查询的连接之外,我不需要针对 AD 进行身份验证。
我偶然发现了“Novell.Directory.Ldap.NETStandard”。
但是当我尝试将其拉入时,它显示“包还原失败”。 “无法解析依赖 Novell.Directory.Ldap.NetStandard >= 2.3.7”。
这是我的 project.json 中的行:
"Novell.Directory.Ldap.NETStandard": "2.3.7",
我在这篇文章中看到这个人试图使用它:
C# netcore ldap authentication using Novell.Directory.Ldap.NETStandard library
他遇到了麻烦,但至少看起来它正在尝试连接,所以他必须能够在 project.json 中安装依赖项。
有人知道如何安装此依赖项吗? 我真的很想在 project.json 中手动完成。该工具似乎真的可以破解文件。 所以我犹豫使用:
Install-Package Novell.Directory.Ldap.NETStandard
在包管理器中。
到目前为止,这是我完整的 project.json:
{
"dependencies": {
"Hrsa.Core.Generic.Model": "1.0.0-*",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.1",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Session": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
//"Novell.Directory.Ldap.NETStandard": "2.3.0",
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Swashbuckle.AspNetCore": "1.0.0-rc3",
"Hrsa.Core.Generic.Service": "1.0.0-*",
"Hrsa.Core.Generic.Repository": "1.0.0-*",
//"Microsoft.Extensions.DependencyModel": "1.1.1",
//"AutoMapper": "6.0.2",
//"AutoMapper.Extensions.Microsoft.DependencyInjection": "2.0.1",
"Hrsa.Core.Common": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"web.config",
"Views",
"appsettings.development.json",
"appsettings.production.json",
"appsettings.staging.json"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
【问题讨论】:
标签: active-directory ldap asp.net-core-mvc .net-core