Telegram Bot throws error only when published - c#

Hi I'm using this library https://www.nuget.org/packages/WTelegramClient/3.2.3-dev.3
I built fully working Telegram bot, but for some reason it works only in debug mode in visual studio.
When I run the application in debug mode it allows me to input all the required fields: api_id, api_hash, phone_number, verification_code and the login is successful.
However when I try to run console application published to folder it throws FLOOD_WAIT_X error every time I enter phone number. I realised it only happens after phone_number input. It looks like something happen when telegram api is about to send verification code.
This is the part of the code that causes error:
(https://i.stack.imgur.com/PdvI3.png)
This is error:
(https://i.stack.imgur.com/g9Fve.png)
I know this error means that I send too many requests, but I tried slowing down requests, different logging types, publishing app to railway.app. It always throws error in the same moment - when the telegram suppose to send me verification code. Just to remind it only happens when the app is published. In debug mode in VS everything works as intended!!!
Different Logging Types
Logging With Environmental Variables
Deploying App to railway.app - same result
Changing publish configuration
Handling error

Related

Debugging C# Bot in VS 2019 issue - no response in Bot after sending Bot a message through MS Teams

I have a Bot that has been programmed in C# using the Bot Framework in .NET 4.8. This Bot has a Bots Channels Registration in Azure, which hooks into an existing app registration in Azure Active Directory, which is where my App ID originates from along with the App Secret. Now to debug my Bot I run Ngrok to tunnel the URL to my localhost at port 3980, which is what the Bot runs in when I debug it. As you can see below the messaging endpoint is the ngrok URL with the "api/messages" part maintained, which is the API endpoint that all messages from MS Teams will go to in my Bot.
The App ID here matches the one of the app registration and the one in my web.config file. I have checked the "app settings" in my web.config file along with the connection string and they are correct.
When I send a message to my Bot in MS Teams nothing comes through and nothing is picked up in the ngrok inspector (http://127.0.0.1:4040/inspect/http).
I would expect this breakpoint to be hit once a message from MS Teams is sent to the Bot.
However, it doesn't get hit and no error or exception is thrown. Nothing is either picked up in the ngrok terminal. I've tried switching my firewall off thinking it may have been security related but this didn't change the outcome. When I change the messaging endpoint to be that of the actual hosted Bot app url, the Bot responds as expected when a message is sent to it in MS Teams. This used to work before when trying to debug using ngrok but now it has suddenly stopped working. Any ideas on what the problem might be? Has anything changed at the ngrok or azure end possibly that I've missed? Any help would be much appreciated on this, thanks!
To check the functionality of bot, the first steps is to test it in WEB CHAT. When the bot was created using any programming language (language is not a major criterion for error), the following will be the possible errors:
Not being able to respond (the current issue)
Throwing errors (As there are no errors in your case)
Working in one channel and error in remaining channels.
When we test the bot using WEB CHAT we can determine the reason for the error, whether it is with bot side or from particular channel (MS Teams in this case).
Test in Web Chat:
There must be a fully functional and ready to use bot must be available to test.
Goto Azure portal (portal.azure.com)
Open the "Test in Web Chat" option
Try to send message to your bot.
If the bot is not responding to the message, refer "bot is not working in web chat" and if the case is like "bot working in one platform and not working in other"
Check the channel configuration issues from.
Document Credit #JonathanFingold and team

Cannot connect to Websphere MQ using ASP.NET but works fine with console application

I've been trying to connect to a Websphere MQ queue manager using ASP.NET but I'm unsuccessfull. My setup is as follows:
I have a DLL where my code for connecting etc is.
I've made 2 projects (on my own PC), a ASP.NET web project and a simple console application. When using the console application I can connect to the queue and get/put messages by impersonating a local user (which is created both on the server and on my PC with same username and password - otherwise I get a MQ 2035 error).
But when calling the exact same code in my ASP.NET project I get an MQ 2059 error. If I avoid impersonating in my ASP.NET project like I do in the console application I get the 2035 AUTHENTICATION error, and by looking in the Event Viewer on the server I see an error "SID: ((None)) could not be resolved" impersonation".
So what I am doing wrong here?
So I got it working after all. It seems that it was an impersonation issue after all. The odd part is that first time I call my code when impersonating a local user on my PC which also is created as a local user on the server, I get a 2059. The second time I call the exact same code literally 2 seconds after, I can now read messages from the queue. Really odd, but calling the read method twice did the trick.

Run c# code on client side or make a web session interactive?

I'm making an application on c# for signing PDFs. Its works perfectly on my visual studio web project, but when I publish it on my test server it throws me this Error
In this case I'm trying to execute the code that sign a pdf on the server and the error occurs specifically on the line:
System.Security.Cryptography.Pkcs.SignedCms.ComputeSignature()
It is supposed to throws a window on your desktop asking for your certificate (reading a smart Card) and then asking for your PIN just like this
Windows Security Window but I have the hunch that it's not possible because Its implies that the server have to have the possibility to interact with the client's desktop
Ok, now that I've explained all the enviroment that I'm facing, here are the solutions I've tried until now:
1) Trying to correct the Server Error above: I went in the server to IIS>application Pool>MyPage>Advanced Settings>Process Model>Load User Profile and selected True instead of False (Didn't Work)
2) Still trying to correct the Server Error I Went to Computer Management>Services and Application>Services and turned on the service "Interactive Service Detection" (Still not working and doesn't work even if I do the same on the client computer)
3)Finally, I guess that it's not possible to run the code on the server because the Error line above is a native calling of Windows Security so I thought: what if I try to run the code right from the client?. Like a c# applet equivalent or something, well... there are two ways for do that: ActiveX (old technology) and Silverlight (newer). The thing is that I just can't make a simple Silverlight program start on chrome, it does on firefox and IE but if doesn't work on chrome is a totally waste so my last option is to make it run with an ActiveX, and there is almost none useful information in the internet about that
If someone can tell me what to do, either to correct the error or to make my program run from the client side, I would be so grateful
You can't call the system's api from a Web client as this would break the sandbox. If you must use that system call, create a wrapper on the server that will handle the popup, although this would be a very "hacky" solution. You should really be asking why I am trying to use a Web client interface if I must use said native system call.

how to solve this error MAPI_E_FAILONEPROVIDER when using Redemption

Hi I have a strange problem and am unable to find out the root cause. We build and deployed our application using Redemption things were working fine but suddenly the installation on UAT server has stopped working. But the same is working in production(Thank God).
Our application is of console based and written using .NET 3.5 its not totally down, it is working but when we try to run the same application via scheduler task it didn't work, but when we double click the exe file it works properly, successfully connect to Exchange reads and download the files as per our business logic but not executing when we try to run under scheduler task.
below is small error info might be helpful for you..
2012-06-15 16:05:06,724 EmailProcess.Program - message = Error in
IMAPISession::OpenMsgStore: MAPI_E_FAILONEPROVIDER ulVersion: 0 Error:
Microsoft Exchange is not available. Either there are network
problems or the Exchange computer is down for maintenance. Component:
Microsoft Exchange Information Store ulLowLevelError: 2147746069
ulContext: 1318
Please suggest
Edit 1: More info Windows 2008 Server, a user named SpecialTasksUser is configured on the server to login and has admin rights. Outlook is installed and profile is configured for different user name OutlookSpecialUser, when we login using SpecialTasksUser user and launch the outlook it loads and shows the inbox and private folders...so far so good.
We created the scheduled task and configured to run under user name SpecialTasksUser because this user has admin rights and this is where it gives error. On the other hand, when we go to installation directory and double click the *.exe file the application works and redemption successuflly reads the email and does what it is suppose to do...please help
I hope this information would be helpful .....
Most likely you are using a wrong parent identity of your process - scheduler runs under its own account by default. Make sure you specify the right Windows account.

How can I catch / report the error elmah hits when trying to send an e-mail?

We are using Elmah to handle our errors, and on some of our servers it is working beautifully but on others it is logging and processing the error but not sending the e-mail. I imagine Elmah is hitting some sort of problem sending the mail but I have no way to see what this problem is.
How can I catch and report (even if just logging to the console or a file) errors Elmah itself hits?
Checkout source, build from there, attach dll`s to Your application, start application in webdev, attach studio that has elmah project opened to webdev, re-produce error and see exactly what's happening.
But in Your case, I would double check if network settings are ok. Seems to me that smtp ports are closed or something. Create small console app that sends e-mails and try to run it on server or use telnet.
have you checked the servers application event log?

Categories

Resources