Twilio Line 30: var Twilio = new TwilioRestClient( - c#

HI I have been trying to authenticate my new asp.net framework 4.5.2 [WEB FORMS] website with twilio for a while the website has nothing on it besides the codes I fallowed in the like while updating with my twilio credentials.
Ive fallowed these steps to a 'T' with the latest version of twilio and restsharp. and I have also tried with using an older package of twilio helper 3.6.23 and restSHarp 104.4.0
http://www.asp.net/web-forms/overview/security/create-an-aspnet-web-forms-app-with-sms-two-factor-authentication#SMS
But every time I try to add a number it prompts me to locate messages.cs which I don't have in that project
out of severe desperateness one time I eventually have even tried to make a replica one with my identity.config and I copy and pasted everything updated in there to my messages.cs file that I made. but still have the same outcome.
and the only difference that using the older version of twilio and restsharp gave me was to locate core.cs [& I'm not sure what that is] then I click cancel and it gives me this same error in visual studio. like it did all the other versions of twilio and restsharp .
An exception of type 'System.MissingMethodException' occurred in Twilio.Api.dll but was not handled in user code Additional information: Method not found: 'Void RestSharp.RestClient.set_BaseUrl(System.Uri)'.
and then it highlights these lines in my identitiyConfig.cs file
var Twilio = new TwilioRestClient(
ConfigurationManager.AppSettings["where I wrote my twilio sid"],
ConfigurationManager.AppSettings["where I wrote my twilio auth token"]
);
finally after I stop debugging I get this error in the browser I was debugging from
Method not found: 'Void RestSharp.RestClient.set_BaseUrl(System.Uri)'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MissingMethodException: Method not found: 'Void RestSharp.RestClient.set_BaseUrl(System.Uri)'.
Then this line is in RED
Line 30: var Twilio = new TwilioRestClient(
Any help will be soooo greatly appreciated or if theres another answer with this exact question that would be amazing as well thanks a ton.
also this in my first year of college in computer science at least so I'm not a programmer genius by any means[obviously lol] but I hope to become one I love to code

Related

XmlException and CryptographicException when running blazor web server app

I receive these two exceptions when I run my blazor web server app:
XmlException: Root element is missing.
CryptographicException: An error occurred while trying to encrypt the provided data. Refer to
the inner exception for more information.
I just created the project and run it... I didn't write any piece of code .
Any help is appreciated because I didn't find any solution till now.
I have found two solutions to fix this issue if someone faced it later.
links to solution:
https://github.com/dotnet/aspnetcore/issues/12830#issuecomment-517907537
https://github.com/dotnet/aspnetcore/issues/12830#issuecomment-606173185

Microsoft Bot Framework V4: System.NullReferenceException: 'Unable to locate SkillConversationIdFactoryBase in HostContext'

I am working on creating a workflow which allows composer created dialogs to be integrated into a bot skill project.
To accomplish this I am trying to follow the instructions in this post: https://microsoft.github.io/botframework-solutions/skills/handbook/experimental-add-composer/
My composer created dialogs including calling a skill. When I initiate that intent through the Bot Emulator I get this error:
System.NullReferenceException: 'Unable to locate SkillConversationIdFactoryBase in HostContext'
The setup to get to this error is time consuming so I have created a git repo which can be started fairly easily to demonstrate the issue.
The project can be found here:
https://github.com/silverbulletgt/Integrate-Composer-Dialog-Using-Skill
To recreate the issue:
Prerequisites
Install Bot Emulator: https://github.com/Microsoft/BotFramework-Emulator/blob/master/README.md
Step to Recreate the Issue
Open the solution file in visual studio
Integrate-Composer-Dialog-Using-Skill.sln
Put a breakpoint on line 72 of DefaultAdapter.cs - this is where the error can be seen
Start debugging the project
Open Bot Emulator
Connect to the bot: http://localhost:3978/api/messages
Type "Greeting"
Bot should respond with "Hello, I have recognized that you said greeting" - This means that the composer dialog integration is working as expected.
Type "Skill"
The breakpoint on line 72 of DefaultAdapter.cs should trigger giving details of the error.
Error & stack trace can be found here: https://github.com/silverbulletgt/Integrate-Composer-Dialog-Using-Skill/blob/master/Readme/error%20stack%20trace.txt
Edit:
I was able to compile the Bot Builder code Bot Builder GitHub & connect it to my project so that I could debug. I found the error to be happening on line 157 of Microsoft.Bot.Builder.Dialogs.Adaptive.BeginSkill.cs code BeginSkill.cs.
This line is trying to get the SkillConversationFactoryBase out of the dialogContext.Context.TurnState. I'm investigating how I might add this so that it is populated when this code executes.
Fix: System.NullReferenceException: 'Unable to locate SkillConversationIdFactoryBase in HostContext' in Microsoft.Bot.Builder.Dialogs.Adaptive.Actions.BeginSkill
This error was being caused by missing dependency injection requirements.
Added the below lines to Startup.cs
services.AddSingleton<SkillConversationIdFactoryBase, SkillConversationIdFactory>();
services.AddSingleton<HttpClient>(new HttpClient());
services.AddSingleton<BotFrameworkClient, BotFrameworkHttpClient>();
Added to DefaultAdapter.cs
New Field
private readonly SkillConversationIdFactoryBase _skillConversationIdFactoryBase;
New constructor parameters
SkillConversationIdFactoryBase skillConversationIdFactoryBase,
BotFrameworkClient botFrameworkClient
To the body of the constructor
_skillConversationIdFactoryBase = skillConversationIdFactoryBase;
Use(new RegisterClassMiddleware<SkillConversationIdFactoryBase>(_skillConversationIdFactoryBase));
Use(new RegisterClassMiddleware<BotFrameworkClient>(botFrameworkClient));
This fixed the initial exception however there was then a new exception when the skill was called.
Exception wasOperation returned an invalid status code 'NotFound'
at Microsoft.Bot.Connector.Conversations.d__10.MoveNext()
Fixing Operation returned an invalid status code 'NotFound'
This exception was occurring because there was no endpiont api/skills. I suppose that the Bot Composer adds this endpoint automatically somehow.
I added SkillController.cs based on the example here: Bot Builder Tests JSON SkillController
Then added dependency injection to support the controller.
Added to Startup.cs
services.AddSingleton<ChannelServiceHandler, SkillHandler>();
services.AddSingleton<BotAdapter>(sp => (BotFrameworkHttpAdapter)sp.GetService<IBotFrameworkHttpAdapter>());
I tested a basic intent which does not use a skill to determine if there would be any conflict with the dependency injection impacting those. The basic intent worked as expected though.
I updated the master branch with the changes Project Repo

Getting 'couldn't send retry' error in web chat for questions which are not present in knowledge base

I created a bot with Azure in C#. This bot is working fine for question which are present in my knowledge base. But when I try different question, it gives error couldn't send retry below that question and reply to that question as Sorry, my bot code is having an issue.
It should reply No match found instead of Sorry, my bot code is having an issue.
One more issue is this bot sometimes gives random answer form KB for some questions which are not present in Kb instead of No answer found in KB.
In web chat channel, it shows following issue - There was an error sending this message to your bot: HTTP status code InternalServerError.
Any help will be appreciated.
First of all, regarding that tutorial:
This article uses Bot Framework v3 SDK. Please see this Bot Framework article, if you are interested in Bot Framework v4 SDK version of this information.
It's old and uses V3 of the Bot Framework SDK. I highly, highly recommend building any new bots in V4. Use the Add natural language understanding tutorial instead.
InternalServerError indicates that there's a problem with your bot code, somewhere.
Here's a few things you can try that are likely causing the issue:
Write code that deals with No Answer
The official QnAMaker Sample does that here:
// Query QnAMaker for Answer
var response = await qnaMaker.GetAnswersAsync(turnContext);
// If we have an answer, send it to the user
if (response != null && response.Length > 0)
{
await turnContext.SendActivityAsync(MessageFactory.Text(response[0].Answer), cancellationToken);
}
// If we don't have an answer, tell that to the user
else
{
await turnContext.SendActivityAsync(MessageFactory.Text("No QnA Maker answers were found."), cancellationToken);
}
Ensure your QnAMaker Service has a DefaultAnswer
This is likely only an issue if you set up your bot to get a default non-answer from your QnAMaker Service.
In Azure Portal > Resource Group > QnA App Service > Configuration (note: this is NOT your bot's app service; this one is specific to QnAMaker), ensure DefaultAnswer is set:
Debug
Assuming that your bot is actually breaking only when and because no QnA Answers were found, those two things should be the only thing you need to troubleshoot. Otherwise, here's how to debug a bot:
Visual Studio/C#:
In Visual Studio, run your bot by pressing F5 or clicking:
Open your bot in Emulator
In Visual Studio, go to Debug > Windows > Exception Settings:
In the Exception Settings window, full-check "Common Language Runtime Exceptions"
In Emulator, do the thing that makes your bot break. The bot should automatically stop when there's an error. Here, I've forced one:
As you can see, it says System.IndexOutOfRangeException: 'Index was outside the bounds of the array.' This means that my array, response doesn't have a 0th element because no answers were returned.
Other issues will show other errors. You can usually pinpoint issues fairly easily by reading the error details and doing a web search for the error code if you need additional details.
VS Code
In VS Code, run your bot by pressing F5 and selecting 'Node.js' (for Node/TypeScript bots) or .NET Core (for C# bots):
Open your bot in Emulator
In VS Code, open the Debug menu:
Under "BREAKPOINTS", check "All Exceptions" (Note: It's important to run your bot before checking this box because there are normal exceptions that occur when the bot starts up):
In Emulator, do the thing that makes your bot break. The bot should automatically stop when there's an error. Here, I've forced one:
As you can see, it says Exception has occurred: TypeError TypeError: Cannot read property 'answer' of undefined This means that qnaResults[0] is undefined, or doesn't exist, which indicates that no answers were returned.
Other issues will show other errors. You can usually pinpoint issues fairly easily by reading the error details and doing a web search for the error code if you need additional details.

Schema specified is not valid. Errors: error 0002: Request failed

I have an EntityFramework project running off MySql that runs great locally as well as on a dedicated server, however I'm trying to move this project to HostGator and I'm receiving the following error:
Schema specified is not valid. Errors:
App_Code.WireWeld.ssdl(2,88) : error 0002: Request failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.MetadataException: Schema specified is not valid. Errors:
App_Code.WireWeld.ssdl(2,88) : error 0002: Request failed.
I know the database is correct as I can connect via Navicat and see its contents. I'm pretty sure the connection string is correct, I have the proper username and password.
I'm really stuck on this one and would appreciate any help possible.
If you are using more than one model in your project I advice you to have a look into that topic as it describes possible solutions to the problem.
If you are not using multiple models than this looks like a file permission issue to me.
Perhaps in the hosted environment, the account underwhich your application is running doesn't have access to where the metadata files are located?
You should make sure you have permission (read/write are required). If this is not an option for you than the only go would be to embed the metadata in the assembly directly and use a res:// style connection string.
If you're using SQL server and have 2 projects - one is a class library and the 2nd one uses that class library in main project, then place both dll from class library project to main project refrence.
1-EntityFramework.dll
2-EntityFramework.SqlServer.dll

ASP.NET FaceBook App Development -

I have downloaded both samples for the Facebook Developer Kit from Codeplex and Facebook.NET followed both tutorials down to the word - But as soon as I browse to me app on Facebook I am getting the following error for BOTH versions?
API Error Code: 100
API Error Description: Invalid parameter
Error Message: Requires valid next URL.
Anyone else had this problem? I'm struggling to find an answer to what the error actually means? Especially as the starts kits are supposed to work out the box?
You need to disable data permissions.
Settings > Migrations > "New Data Permissions" > Disabled

Categories