WTelegramClient on Azure Function session file is being used by another process

258 views Asked by At

I made a simple Azure Function using WTelegramClient. It is configured to run every 10 minutes and session file is created without any problems.

In logs, however, I see that it runs successfully only around once an hour, another 5 times it throws following error:

The process cannot access the file 'C:\home\site\wwwroot\bin\WTelegram.session' because it is being used by another process.

This is a session file path configured in App:

case "session_pathname": return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "WTelegram.session");

Deployment is done through VS 2022 as a Zip Package.

Please help.

1

There are 1 answers

1
Wizou On BEST ANSWER

Dispose the client when you're done using it