通过Azure混合连接访问共享文件夹 [英] Access Shared Folder Via Azure Hybrid Connection
问题描述
我正在寻找一种通过Azure混合连接访问网络中共享文件夹的内容的方法.我知道我可以使用连接管理器访问SQL SERVER,但是有没有一种方法可以在不使用本地系统中创建专用服务的情况下访问专用网络中的文件?
I'm looking for a way to access the content of a shared folder in the network via Azure hybrid connections. I know I can access to SQL SERVER using Connection Manager, but is there a way to access files in the private network without creating a dedicated service in the on-premises system?
更新: 我将端口139和445添加到了连接管理器端点,并与指定服务器上的所有人共享了一个文件夹.然后使用可访问我的混合连接的App Service Plan创建了一个Azure功能.我编写了以下代码来测试与共享文件夹的连接:
UPDATE: I added port 139 and 445 to the connection manager endpoints and shared a folder to everyone on the designated server. Then created an azure function with an App Service Plan that had access to my hybrid connection. I wrote the following code to test the connection to the shared folder:
public static IActionResult Run(HttpRequest req, ILogger log)
{
var files = Directory.GetFiles(@"\\ServerName\FolderName", "*.*", SearchOption.AllDirectories);
foreach (var file in files)
{
log.LogInformation(file);
}
return new OkResult();
}
运行该函数时,出现访问路径被拒绝"的提示.错误.
When I run the function, I get "Access to the path is denied." error.
推荐答案
App Service沙箱明确不允许访问SMB协议所需的端口(137/138/139/445).
The App Service sandbox explicitly does not allow access to the ports necessary for SMB protocol (137/138/139/445).
本文在受限出站端口"下对此进行了提及:
This article mentions it under Restricted Outgoing Ports:
https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox .
这篇关于通过Azure混合连接访问共享文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!