Microsoft.Azure.Storage.Common:由于目标计算机主动拒绝连接,因此无法建立连接


*[2022-07-21T11:29:11.318Z] The listener for function 'Functions.BlobTriggerFunction' was unable to start.
[2022-07-21T11:29:11.319Z] The listener for function 'Functions.BlobTriggerFunction' was unable to start. Microsoft.Azure.Storage.Common: No connection could be made because the target
machine actively refused it. System.Net.Http: No connection could be made because the target machine actively refused it. System.Private.CoreLib: No connection could be made because t
he target machine actively refused it.
[2022-07-21T11:29:12.311Z] An unhandled exception has occurred. Host is shutting down.
[2022-07-21T11:29:12.312Z] Microsoft.Azure.Storage.Common: No connection could be made because the target machine actively refused it. System.Net.Http: No connection could be made beca
use the target machine actively refused it. System.Private.CoreLib: No connection could be made because the target machine actively refused it.*

我已经使用IntelliJ IDEA Java创建了azure函数blob触发器,之后我尝试在本地运行它,然后它给了我这个错误。

public class BlobTriggerFunction {
/**
* This function will be invoked when a new or updated blob is detected at the specified path.
* The blob contents are provided as input to this function.
*/
@FunctionName("BlobTriggerFunction")
@StorageAccount("AzureWebJobsStorage")
public void run(
@BlobTrigger(name = "content", path = "ys01/{name}", dataType = "binary",
connection = "AzureWebJobsStorage") byte[] content,
@BindingName("name") String name,
final ExecutionContext context
) {
context.getLogger().info("Java Blob trigger function processed a blob. Name: " + name + "n  Size: "
+ content.length + " Bytes");
System.out.println("logger ");
}

}

由于目标机器主动拒绝,因此无法建立连接。

  • 这可能是由于您的端口已经被其他功能或进程使用,所以请更改为不同的端口并进行检查。

  • 还要确保本地存储模拟器正在运行。如果没有,请启动Azure存储模拟器。

参考Mayank Bargali在问答中给出的解决方法之一;论坛。

最新更新