OfficeDev / ews-managed-api

Other
585 stars 322 forks source link

create meeting set timezone error in docker net core #264

Closed wongkafai closed 3 years ago

wongkafai commented 3 years ago

error message: An item with the same key has already been added. Key: Dlt/1941

Below is the source code:

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2016);
 service.Credentials = new NetworkCredential(userName, password, domain);
 service.Url = new Uri(mainServerUrl);

  Appointment appointment = new Appointment(service);
  appointment.StartTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Asia/Hong_Kong");
  appointment.Start = startTime;
  appointment.End = endTime;

docker using net core 3.1

Dockerfile

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS publish
ENV TZ=Asia/Hong_Kong
COPY SMTP.Core /src/SMTP.Core
WORKDIR /src/SMTP.Core
RUN dotnet restore "SMTP.Core.csproj"
RUN dotnet publish "SMTP.Core.csproj" -c Release -o /app

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
ENV TZ=Asia/Hong_Kong
ENV DEBIAN_FRONTEND="noninteractive" 
RUN echo $TZ > /etc/timezone && \
    apt-get update && apt-get install -y tzdata && \
    rm /etc/localtime && \
    ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
    dpkg-reconfigure -f noninteractive tzdata && \
    apt-get clean
WORKDIR /vault/secrets
RUN ln -s /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so
RUN apt-get update -q && \
    apt-get upgrade -qy && \
    apt-get install -qy libgdiplus && \
    apt-get install -qy gss-ntlmssp
RUN ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so

EXPOSE 8080
WORKDIR /app
COPY --from=publish /app .

ENTRYPOINT ["dotnet", "SMTP.Core.dll"]