本篇文章给大家谈谈尝试创建webhook智能表时出错,以及尝试创建数据库失败的知识点,同时本文还将给你拓展adnanhwebhook框架hookrule、c#–如何在ASP.NETMVC中创建webh
本篇文章给大家谈谈尝试创建 webhook 智能表时出错,以及尝试创建数据库失败的知识点,同时本文还将给你拓展adnanh webhook 框架 hook rule、c# – 如何在ASP.NET MVC中创建webhook?、c# 尝试创建或写入文件时出错、Dialogflow Webhook Firestore 返回 webhook 失败状态代码 04,如何修复并从 Firestore 获取输出?等相关知识,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:- 尝试创建 webhook 智能表时出错(尝试创建数据库失败)
- adnanh webhook 框架 hook rule
- c# – 如何在ASP.NET MVC中创建webhook?
- c# 尝试创建或写入文件时出错
- Dialogflow Webhook Firestore 返回 webhook 失败状态代码 04,如何修复并从 Firestore 获取输出?
尝试创建 webhook 智能表时出错(尝试创建数据库失败)
如何解决尝试创建 webhook 智能表时出错?
属性“callbackUrl”仅支持协议为“https”的网址
Error
解决方法
此错误消息的含义正是它所说的:您为 Create Webhook 请求中的 callbackUrl
属性指定的值必须以 https:
开头。如果您为 callbackUrl
属性指定的值以 http:
开头,那么您将收到此错误消息作为响应。出于安全原因设置此限制 - 即,Smartsheet 只会向安全端点发送网络钩子通知。
adnanh webhook 框架 hook rule
adnanh webhook 支持一系列的逻辑操作
AND
所有的条件都必须匹配
{
"and":
[
{
"match":
{
"type": "value",
"value": "refs/heads/master",
"parameter":
{
"source": "payload",
"name": "ref"
}
}
},
{
"match":
{
"type": "regex",
"regex": ".*",
"parameter":
{
"source": "payload",
"name": "repository.owner.name"
}
}
}
]
}
OR
匹配条件中有一个为 true 即可
{
"or":
[
{
"match":
{
"type": "value",
"value": "refs/heads/master",
"parameter":
{
"source": "payload",
"name": "ref"
}
}
},
{
"match":
{
"type": "value",
"value": "refs/heads/development",
"parameter":
{
"source": "payload",
"name": "ref"
}
}
}
]
}
NOT
为 false 是执行
{
"not":
{
"match":
{
"type": "value",
"value": "refs/heads/development",
"parameter":
{
"source": "payload",
"name": "ref"
}
}
}
}
混合
{
"and": [
{
"match": {
"parameter": {
"source": "header",
"name": "X-Hub-Signature"
},
"type": "payload-hash-sha1",
"secret": "mysecret"
}
},
{
"or": [
{
"match":
{
"parameter":
{
"source": "payload",
"name": "ref"
},
"type": "value",
"value": "refs/heads/master"
}
},
{
"match":
{
"parameter":
{
"source": "header",
"name": "X-GitHub-Event"
},
"type": "value",
"value": "ping"
}
}
]
}
]
}
match 原则
- 值匹配
{
"match":
{
"type": "value",
"value": "refs/heads/development",
"parameter":
{
"source": "payload",
"name": "ref"
}
}
}
- 正则匹配
{
"match":
{
"type": "regex",
"regex": ".*",
"parameter":
{
"source": "payload",
"name": "ref"
}
}
}
- hash sha1 算法匹配
{
"match":
{
"type": "payload-hash-sha1",
"secret": "yoursecret",
"parameter":
{
"source": "header",
"name": "X-Hub-Signature"
}
}
}
- ip 白名单匹配
{
"match":
{
"type": "ip-whitelist",
"ip-range": "192.168.0.1/24"
}
}
参考资料
https://github.com/adnanh/webhook/blob/master/docs/Hook-Rules.md
c# – 如何在ASP.NET MVC中创建webhook?
在帐户设置过程中,系统会要求您向Nexmo提供一个用于送达回执的回拨网址,我们将为您的每个短信提交发送送达回执.这将确认您的消息是否已到达收件人的手机.请求参数通过GET(默认)发送到您的回拨URL,Nexmo将期待响应200 OK响应,或者它将继续重试,直到发送收据到期(最多72小时).
我一直在寻找这样做的方法,到目前为止,我从网上找到的一个例子中得到了这个方法,虽然我不确定这是否正确.无论如何,这是在ASP.NET和端口6563上运行,所以这是我应该听的端口吗?我下载了一个名为ngrok的应用程序,它应该将我的本地Web服务器暴露给互联网,所以我运行了应用程序并指示它监听端口6563,但没有运气.我一直在试图找到一些帖子来发布这个功能.
[HttpPost] public ActionResult CallbackURL() { System.IO.StreamReader reader = new System.IO.StreamReader(HttpContext.Request.InputStream); string rawSendGridJSON = reader.ReadToEnd(); return new HttpStatusCodeResult(200); }
通常我可以通过访问http:// localhost:6563 / Home / Index / CallbackURL直接调用函数返回视图
所以我在方法签名上插入了一个断点,但是只有从它中删除[HttpPost]才会被调用.我应该尝试的任何后续步骤?
解决方法
然后你还应该删除返回HttpStatusCodeResult(200),因为如果没有错误发生,它将返回200 OK状态代码.
然后,您应该只是从查询字符串或使用模型绑定读取值.这是一个示例:
public string CallbackURL() { string vals = ""; // get all the sent data foreach (String key in Request.QueryString.AllKeys) vals += key + ": " + Request.QueryString[key] + Environment.NewLine; // send all received data to email or use other logging mechanism // make sure you have the host correctly setup in web.config SmtpClient smptClient = new SmtpClient(); MailMessage mailMessage = new MailMessage(); mailMessage.To.Add("...@...com"); mailMessage.From = new MailAddress("..@....com"); mailMessage.Subject = "callback received"; mailMessage.Body = "Received data: " + Environment.NewLine + vals; mailMessage.IsBodyHtml = false; smptClient.Send(mailMessage); // Todo: process data (save to database?) // disaplay the data (for degugging purposes only - to be removed) return vals.Replace(Environment.NewLine,"<br />"); }
c# 尝试创建或写入文件时出错
如何解决c# 尝试创建或写入文件时出错?
使用 Windows 窗体的 C# 中的这段代码给了我一个错误,说该文件被另一个进程使用,尽管我没有在任何地方打开它。
private void browseBtn2_Click(object sender,EventArgs e)
{
CommonopenFileDialog dialog = new CommonopenFileDialog();
dialog.InitialDirectory = "C:\\Users";
dialog.IsFolderPicker = true;
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
MessageBox.Show("You selected: " + dialog.FileName);
this.outputPathText.Text = dialog.FileName;
}
}
private void genBtn_Click(object sender,EventArgs e)
{
string path = outputPathText.Text+@"\test.txt";
TextWriter tw = new StreamWriter(path); //gives me the error here -_-
tw.WriteLine("The very first line!");
tw.Close();
genSuccess.Visible = true;
wait(2000);
genSuccess.Visible = false;
}
解决方法
现在不确定这是否是您的问题的原因,但您的问题可能是因为您没有习惯 Dispose 实现 IDisposable 的对象。
如果一个对象实现了 IDisposable,那么该对象的设计者认为它拥有稀缺资源。应尽快处理。
我看到的一个问题是,当人们忘记释放对文件的访问权限时,您无法删除它,因为它仍在使用中。
string bitmapFileName = "MyTestFile.bmp";
Bitmap testBitmap = new Bitmap(bitmapFileName);
... // do something with the bitmap. Or not,if you don''t want to
// after a while you don''t need the bitmap anymore
testBitmap = null;
System.IO.File.Delete(testBitMap); // Exception! File still in use
尽量养成 Dispose 实现 IDisposable 的习惯:
string fileName = outputPathText.Text+@"\test.txt";
using (TextWriter textWriter = File.Create(fileName))
{
textWriter.WriteLine("The very first line!");
}
就是这样:不需要 Flush 或 Close,textWriter 的 Dispose 会为你做这些。
同样:
using (var bmp = new Bitmap(testBitmap))
{
... // do something with it,or not if you don''t want to
}
// now the bitmap can be deleted
File.Delete(testBitmap);
我对 CommonOpenFileDialog 不熟悉,无法轻易找到微软的描述,但如果实现 IDisposable,就像每个 Form 一样,它也应该被处理:
using (var dialog = new CommonOpenFileDialog())
{
dialog.InitialDirectory = "C:\\Users";
dialog.IsFolderPicker = true;
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
MessageBox.Show("You selected: " + dialog.FileName);
this.outputPathText.Text = dialog.FileName;
}
}
Dispose 将清理 CommonOpenFileDialog 中的所有内容并释放所有使用的资源。
,它可能被程序的旧实例或某些故障进程打开。我建议检查任务管理器并重新启动资源管理器。在 MacOS 上,我遇到了类似的问题,不得不重新启动计算机。
Dialogflow Webhook Firestore 返回 webhook 失败状态代码 04,如何修复并从 Firestore 获取输出?
如何解决Dialogflow Webhook Firestore 返回 webhook 失败状态代码 04,如何修复并从 Firestore 获取输出??
我正在尝试将 dialogflow 与 firestore 集成,但无法获得所需的输出。诊断信息提供以下错误。我需要根据代理的给定输入从 Firestore 获得响应,这是基本要求,但在集成时出现此错误。
{
"responseId": "a6a119a8-c406-4af2-aab0-b6863fb091a4-59c3eb0f","queryResult": {
"queryText": "15APC2375","parameters": {
"regno": "15APC2375"
},"allrequiredParamsPresent": true,"intent": {
"name": "projects/cis-bot-yhrvph/agent/intents/e3b1292b-89b1-48b7-b4b4-805a63d08168","displayName": "request-results"
},"intentDetectionConfidence": 0.3,"diagnosticInfo": {
"webhook_latency_ms": 4892
},"languageCode": "en"
},"webhookStatus": {
"code": 4,"message": "Webhook call Failed. Error: DEADLINE_EXCEEDED."
}
}
我的 Package.json 包含以下代码。
{
"name": "dialogflowFirebaseFulfillment","description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase","version": "0.0.1","private": true,"license": "Apache Version 2.0","author": "Google Inc.","engines": {
"node": "10"
},"scripts": {
"start": "firebase serve --only functions:dialogflowFirebaseFulfillment","deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment"
},"dependencies": {
"firebase": "^7.13.2","actions-on-google": "^2.2.0","firebase-admin": "^5.13.1","firebase-functions": "^2.0.2","dialogflow": "^0.6.0","dialogflow-fulfillment": "^0.5.0"
}
}
以及 index.js 包括以下代码。
''use strict'';
const firebase = require(''firebase'');
const functions = require(''firebase-functions'');
const admin = require(''firebase-admin'');
const {WebhookClient} = require(''dialogflow-fulfillment'');
const {Card,Suggestion} = require(''dialogflow-fulfillment'');
admin.initializeApp();
const db = admin.firestore();
process.env.DEBUG = ''dialogflow:debug''; // enables lib debugging statements
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request,response) => {
const agent = new WebhookClient({ request,response });
console.log(''Dialogflow Request headers: '' + JSON.stringify(request.headers));
console.log(''Dialogflow Request body: '' + JSON.stringify(request.body));
function welcome(agent) {
agent.add(`Welcome to CIS BOT!`);
}
function fallback(agent) {
agent.add(`Please Contact the Front Desk for more information`);
}
function getResults(agent){
const regno=agent.parameters.regno;
const dialogflowAgentDoc = db.collection(''results'').where("reg_id","==",''15APC2375'')
.get()
.then((querySnapshot) => {
querySnapshot.forEach((doc) => {
// doc.data() is never undefined for query doc snapshots
agent.add(doc.data().grade);
});
}).catch(() => {
agent.add(''Error reading entry from the Firestore database.'');
agent.add(''Please add a entry to the database first by saying,"Write <your phrase> to the database"'');
});
}
let intentMap = new Map();
intentMap.set(''Default Welcome Intent'',welcome);
intentMap.set(''Default Fallback Intent'',fallback);
intentMap.set(''request-results'',getResults);
// intentMap.set(''your intent name here'',googleAssistantHandler);
agent.handleRequest(intentMap);
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
关于尝试创建 webhook 智能表时出错和尝试创建数据库失败的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于adnanh webhook 框架 hook rule、c# – 如何在ASP.NET MVC中创建webhook?、c# 尝试创建或写入文件时出错、Dialogflow Webhook Firestore 返回 webhook 失败状态代码 04,如何修复并从 Firestore 获取输出?的相关信息,请在本站寻找。
本文标签: