-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Linux] System.DirectoryServices.Protocols is not supported on this platform #77022
Comments
Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014 Issue DetailsI have error of System.DirectoryServices.Protocols is not supported on this plartform while I'm using 5.18.19-3-MANJARO (64-bit), with the 6.0.9 runtime The exception is thrown while executing the following statement: var connection = new LdapConnection(domain); I tried both versions 6.0.1 and 7.0.0-rc.2.22472.3, and the issue is occurring every time. I use .NET6 for this project. According to the research I've done, this package should be cross-platform on both Mac and Linux for a few years now, am I missing something to be able to use it?
|
What is the exact error you are getting, with a stack trace?
You do need libldap-2.4.so.2 available on your system. Do note that if your distribution comes with a newer version of libldap like 2.5 or 2.6, there is a known issue loading those. #69456 |
Hi there, Here is the stack trace System.PlatformNotSupportedException: System.DirectoryServices.Protocols is not supported on this platform.
at System.DirectoryServices.Protocols.DirectoryConnection..ctor()
at System.DirectoryServices.Protocols.LdapConnection..ctor(String server)
at CRM_API.Utilities.GetADUsers() in /home/lopb/Desktop/CRM-API/Utilities.cs:line 16
at CRM_API.Controllers.UsersController.Get() in /home/lopb/Desktop/CRM-API/Controllers/UsersController.cs:line 16
at lambda_method3(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() Both libldap and lib32-libldap 2.6.3-1 are already installed on my system. When I compare the stack trace of the issue you linked and mine, they don't seem to be related. |
@Lemaus123 what is the output of Line 18 in 888ad2b
|
Thanks for logging the issue @Lemaus123 and thanks for the replies @vcsjones, indeed this looks like a case where the package is either not consumed correctly or the app is not being deployed correctly, as @Lemaus123 is getting the RIDless configuration as opposed to getting the Linux one. @Lemaus123 if you could share the code inside your .csproj as well as the instructions on how you are deploying and running your app it would be helpful in figuring out what is going on here. |
This issue has been marked |
Here is the output of dotnet --info
Here is my .csproj <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>disable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>CRM_API</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Npgsql" Version="6.0.7" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.7" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="System.DirectoryServices.Protocols" Version="6.0.1" />
</ItemGroup>
</Project> I'm using Ryder so i'm not sure what to answer about how i'm running my app since its all automatic. My coworker use it on the same project on his Windows OS and the package work very well, so the way the package is consumed should not be the problem. |
Related #62554 ? |
With all your help I figured out a way to make this work for now. By adding <RuntimeIdentifier>linux-x64</RuntimeIdentifier> in my .csproj the platform was correctly identified. |
Glad you got it to work, closing this as it seems that you are unblocked now. |
I have error of System.DirectoryServices.Protocols is not supported on this plartform while I'm using 5.18.19-3-MANJARO (64-bit), with the 6.0.9 runtime
The exception is thrown while executing the following statement:
I tried both versions 6.0.1 and 7.0.0-rc.2.22472.3, and the issue is occurring every time.
I use .NET6 for this project. According to the research I've done, this package should be cross-platform on both Mac and Linux for a few years now, am I missing something to be able to use it?
The text was updated successfully, but these errors were encountered: