Issue with .NET Core Docker and NTLM Support
Recently, I've been making some changes to a .NET 8 app and deploying it to a Docker-based environment. The code will use the Exchange Web Services (EWS) library to make a query to on-prem Exchange server for some information. When trying to connect to Exchange, the code reports the following error when first run.
Error: libgssapi_krb5.so.2: cannot open shared object file: No such file or directory
It seemed like there was a record issue at first, but when we ran the same code on my macbook, it worked fine as well. After that, I started digging around and realized the above message existed in the Docker image's log. After some Google searches, it seems to be caused by a missing component in the Docker image. After checking several sources (Google, Stackoverflow), I added the following line to the Dockerfile, which installs the required components during the build process. Then the code works fine.
RUN apt-get update && apt-get install -y libgssapi-krb5-2
It seems that the EWS Managed API library uses some library that always uses Windows Authentication (or at least triggers it) when trying to connect to EWS URLs.
PS: Thanks to https://github.com/sherlock1982/ews-managed-api to making a .NET core supported version of the EWS Managed API library