- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 HTTP 触发器/Azure 函数,它尝试写入服务总线。当我尝试通过 POSTMAN 本地触发时,这是我在 VSCODE 中遇到的错误:
[2022-02-25T17:47:27.426Z] Executed 'mytestmethod' (Failed, Id=61291e4d-92de-4306-93ba-c0902dbaae3b, Duration=96242ms)
[2022-02-25T17:47:27.428Z] System.Private.CoreLib: Exception while executing function: O3mWorkspaceNotifications. System.Private.CoreLib: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ErrorCode: TimedOut (ServiceCommunicationProblem). System.Private.CoreLib: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
所以我找到了这篇文章:https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-troubleshooting-guide
我尝试添加防火墙规则来打开所有传入/传出到我的特定 IP 地址的内容。为了获取 IP 地址,我在 powershell 中运行了以下命令:
PS C:\Users\me\.azure> tnc myresourcegroup-bus.servicebus.windows.net -port 5671
WARNING: TCP connect to (111.11.1.11 : 5671) failed
WARNING: Ping to 111.11.11.11 failed with status: TimedOut
ComputerName : myresourcegroup-bus.servicebus.windows.net
RemoteAddress : 111.11.11.11
RemotePort : 5671
InterfaceAlias : Ethernet
SourceAddress : 10.111.11.111
PingSucceeded : False
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False
我在本地 Windows 10 开发盒上添加了传入和传出固件规则。我添加了一条“自定义规则”,允许该特定 IP 地址的所有程序、所有端口。
然后我尝试 telnet 到我的 azure 服务总线,但它在我面前爆炸了:(尝试通过 Windows 10 上的 ubuntu 子系统进行 telnet)
admin@CAMXL0332ZPD:/mnt/c/Users/me$ telnet 111.11.11.11 5671
Trying 111.11.11.11...
telnet: Unable to connect to remote host: Resource temporarily unavailable
不确定还需要检查什么。任何提示将不胜感激。
编辑 1
这就是我的代码现在的样子:
public class mywidgetsclass {
[FunctionName("widgetsNotifications")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "mywidgets/sbnotification")] HttpRequest req,
[ServiceBus("widgets", ServiceBusEntityType.Queue, Connection = "WidgetsServiceBus")] IAsyncCollector<WidgetsNotification> outputQueue,
ILogger log)
{
log.LogInformation($"WidgetsNotificationPOST method invoked");
var content = await new StreamReader(req.Body).ReadToEndAsync();
log.LogInformation($"Received following payload: {content}");
var widgetsNotification= JsonConvert.DeserializeObject<WidgetsNotification>(content);
await outputQueue.AddAsync(widgetsNotification);
var response = new {widgetsNotification, QueuedResult=true};
return new OkObjectResult(response);
}
}
最佳答案
您的网络环境似乎不允许端口 5671 和 5672 的流量。这通常可以通过将 ServiceBusClient
配置为使用使用端口 443(默认 HTTPS 端口)的 Web 套接字传输来解决:
var options = new ServiceBusClientOptions
{
TransportType = ServiceBusTransportType.AmqpWebSockets
};
var client = new ServiceBusClient("<< CONNECTION STRING >>", options);
对于服务总线触发器和绑定(bind)的 Azure Functions 配置,使用 Microsoft.Azure.WebJobs.Extensions v5.0+ 时,可以在
包。host.json
中指定传输。 ServiceBus
{
"extensions": {
"serviceBus": {
"transportType" : "amqpWebSockets"
}
}
关于azure - 从本地 Windows 10 盒子连接到 azure 服务总线失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71269918/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!