Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Botframework 什么';由于在bot框架中命中localhost:9000,导致500个内部服务器错误?_Botframework - Fatal编程技术网

Botframework 什么';由于在bot框架中命中localhost:9000,导致500个内部服务器错误?

Botframework 什么';由于在bot框架中命中localhost:9000,导致500个内部服务器错误?,botframework,Botframework,每次我尝试向我的机器人发送消息时,或在它以3条消息连续响应后,都会出现此错误 我在获取异常的代码周围放置了一个try/catch(从调用context.PostAsync)并将其记录在我的Application Insights实例中: An error occurred while sending the request. Unable to connect to the remote server An attempt was made to access a socket in a way

每次我尝试向我的机器人发送消息时,或在它以3条消息连续响应后,都会出现此错误

我在获取异常的代码周围放置了一个
try/catch
(从调用
context.PostAsync
)并将其记录在我的Application Insights实例中:

An error occurred while sending the request.
Unable to connect to the remote server
An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:9000
当然,我的代码中没有任何内容会影响
localhost
。。。还有人看到这个吗

发生错误时正在运行的代码:

var j = JToken.Parse(responseJson);
foreach (var b in j["value"])
{
    await context.PostAsync($"{b.Value<string>("id")} - {b.Value<string>("name")}");
}
var j=JToken.Parse(responseJson);
foreach(变量b在j[“值”])
{
wait context.PostAsync($“{b.Value(“id”)}-{b.Value(“name”)});
}
当我在本地运行bot并使用仿真器进行测试时,我得到了3个输出项,但在第4个输出项为500(这并不是由于格式错误导致json解析失败)


当我发布到Azure应用程序服务时,我收到了500个错误,没有任何输出。

您是否通过模拟器连接到部署的服务

如果是这样,则可能会产生此错误,因为当我们看到来自channelId=“emulator”的消息时,异步消息将路由到。这将导致使用此端口


要测试它的部署,您应该从bot配置页面上的测试窗口开始,或者使用网络聊天控件。

我们的应用程序中也有类似的问题。通过在我们的对话框类中没有从
LuisDialog
派生的私有
LuisResult
属性,成功解决了500个无效响应

我猜,由于类被标记为
Serializable
,它试图序列化所有属性,而
LuisResult
无法序列化

下面是一段代码片段:

更改:

[Serializable]
public class YourDialog : LuisDialog<MySerializableClass>
{
    private LuisResult _myPrivateProp;
}
[可序列化]
公共类对话:LuisDialog
{
私人LuisResult_myPrivateProp;
}
致:

[可序列化]
公共类对话:LuisDialog
{
私有字符串_myPrivateProp;//或其他任何内容
}

我还面临“500内部服务器错误” 更新到最新的“Bot框架模拟器”解决了我的问题

:

:


希望这有帮助。

有趣。。。那么,如果我通过emulator连接,我该怎么办?将bot重新部署到azure,并确保不首先使用emulator触碰它?这也解释了3-then-500的行为吗?我认为我们问题的根源确实是可序列化的,但是很奇怪,机器人在没有属性的情况下会对最初的几个查询做出很好的响应。。。。。。¯\_(ツ)_/¯
[Serializable]
public class YourDialog : LuisDialog<MySerializableClass>
{
    private string _myPrivateProp;//or whatever
}