Cannot post activity. Unauthorized - c#

For some reason, I am unable to start even the simplest bot in Bot Framework Emulator.
Steps to reproduce:
In VS2019, create new Echo Bot (Bot Framework v4 - .NET Core 3.1) project (using Bot Framework v4 SDK Templates for Visual Studio)
Run project without making any changes whatsoever (empty strings for MicrosoftAppIdand and MicrosoftAppPasswordin in appsettings.json)
Start Bot Framework Emulator
http://localhost:3978/ opens up in the browser without issue but in the Emulator I get the below errors:
Cannot post activity. Unauthorized.
POST 401 directline/conversations/<conversationId>/activities
What could be causing these errors with such a minimal project? My understanding is this should just work straight out of the box when running on localhost and no security credentials have been provided.
I am using a work computer and I'm wondering if there is something 'behind the scenes' blocking a connection somewhere/somehow? I have no idea where to look, though. It works fine on another computer and was working fine on this machine when I last tried a couple of months ago so I'm really confused.
Any clues or suggestions on how to debug this problem would be greatly appreciated.

Related

After migration from .NET core 2.2 to .NET 5 the application won't start after deploying to azure app service - startup timeout

I am having the following problem. A while ago I migrated my project from .net core 2.2 to .net 5. Migration itself was no problem, locally everything worked almost out of the box. But then I was facing problems deploying the app into an azure app service. The app wouldn't start up. I was getting start up timeouts. After a while I solved the problem by switching the hosting model to outOfProcess
<PropertyGroup>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
Because of lack of time to thoroughly test the application, I had to stick with .net 2.2 until now.
Now that I migrated again, I am facing the same issue. Locally everything works just fine, but after deploying to the app service, the application won't start. But the hostingModel doesn't solve it this time.
I tried linux and windows app service, and I tried to deploy via our azure devops pipes as well as manually from VS. I tried to deploy into an existing app service, I tried to deploy into a new app service, created during the deployment process. None of it solves it.
When i look at the log stream, I see the following:
2022-02-10T09:13:55.360Z ERROR - Container webapp... for site t2bwebappdev did not start within expected time limit. Elapsed time = 230.2593377 sec
2022-02-10T09:13:55.368Z ERROR - Container webapp... didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
So I tried to solve this via PORTS and WEBSITES_PORT settings - but non of it seems to get it up and runnig.
Thanks in advance for any hints on how to solve this.
Update:
While I was playing around with the logs, I saw that the app was listening on port 5000. Seems with the Net5 upgrade the launchsettings.json is being ignored.
Then I just dockerized it from VS 2019, and in that container I can also not reach the app. So after all this, could it just be a port issue?
Try adding this line in your Program.cs class:
And make sure you expose ports in Dockerfile:
NOTE:
Everything depends on which port was exposed in Dockerfile.
Port that you have exposed should match with the port you will pass to UseUrls as an argument. Also, consider either http/https in accordance with the existence of the certificate.
I hope my answer was useful and helpful!

Problem with AzureStorageEmulator.exe Azure SDK and Visual Studio related

Premise: I'm a frontend web developer and I had to launch a project written in C# that has many dependencies. I tried to set the enviroment but I had many issues, this is one that neither I, nor the people around me, can resolve (at least we couldn't until now).
When I try to run the solution it always throws an error and open a popup where it writes something like "it is not possible run Azure storage emulator. Run AzureStorageEmulator.exe as administrator and try again". I tried to run the command but it tells me that it is not installed. I unistalled and installed again the Azure SDK, still the error, I installed the storage emulator from here https://learn.microsoft.com/en-us/azure/storage/common/storage-use-emulator#using-sdk but nothing.
What can I do?
I'm using Visual Studio 2019, .net core 2.2 and Azure SDK
Sorry for my funny English, I'm not native.

Getting System.BadImageFormatException and System.InvalidProgramException in ASP.Net Core app in Azure App Service

Over the past couple of days I've observed a significant number of 500's being returned from our web service, and digging into the logs, see these two exceptions occuring:
System.BadImageFormatException - Bad IL range.
System.InvalidProgramException - Common Language Runtime detected an invalid program.
I am unable to repro on a local instance, and can't get any further info from Azure. Rebooting the machine and redeploying the code do not help. The set of NuGet packages we use haven't changed in quite some time.
This is a ASP.Net Core app running on .Net Core 2.2, hosted in an Azure App Service.
Any suggestions welcome.
I had seen the same questions in one of my emails and had to dig up to see what the solution is.
If you have enabled Application Insights through Portal's Extensions tab please turn it off and enable Application Insights through Portal's Application Insights tab. This should solve your problem hopefully. Here is the issue

Azure Bot Service code update with continues developmemt

We had set up a bot service with LUIS in c# for a few months, now on we want to enable continues development with VSTS. we had set up the project in VSTS and commit the source without problem. And the bot service is configured with VSTS and able to deploy successfully without errors. But we found the bot still operating with sample code logic and the code still a sample code in the build tab. Is it any solution to let the bot service replace the old sample code?
I personally recommend using the SDK over Azure Bot Service, but that is a personal preference. I say this because it feels much like any project in Visual Studio and there are fewer steps to set up continuous deployment and other things like debugging locally.
For Azure Bot Service continuous deployment please read through this link to get started and make sure you did not miss a step. There are also instructions to debug your bot locally here. I hope this helps, please let me know if it does not.

install UCMA 3.0 and create a trusted application pool

I am following the tutorial
.As explained in the tutorial, I have installed UCMA 3.0 SDK
Next is, I ran Run Bootstrapper.exe /BootstrapLocalMgmt /MinCache successfully.
In the third step, I am trying to run the command Run Get-CsSite to get the SiteId, but I am getting an error as:
"Cannot find information about the local domain".
I am not sure about this error. Can somebody help me out with this. I am doing this on an azure machine.
Assuming that your machine is correctly joined to the domain, and meets the other pre-requisites:
You may be missing the configuration store, or the Lync components installation didn't succeed or didn't perform all needed setup properly.
I'd suggest to run the Lync 2010 setup (UI) on that machine, in order to have it joining the Lync farm properly (I use to do in this way), and get the configuration store as well.
My suggestion is to perform Step 3 and 4 from the following article:
http://lyncinsider.com/conferencing/how-to-add-new-servers-to-lync-20-tasks-every-lync-administrator-must-know/

Categories

Resources