Sco*_*y H 5 .net connection-string azure azure-storage
我的Azure WebJob的App.config中有这些连接字符串
<add name="AzureWebJobsDashboard" connectionString="UseDevelopmentStorage=true"/>
<add name="AzureWebJobsStorage" connectionString="UseDevelopmentStorage=true"/>
Run Code Online (Sandbox Code Playgroud)
因为我希望它默认为开发人员使用Azure存储模拟器。但是,在Azure上使用这些WebJob时,尽管我已在Azure Portal界面中设置了以下连接字符串,但它们似乎仍指向本地存储:
我推断它仍指向本地存储,因为出现此错误:
Microsoft.WindowsAzure.Storage.StorageException:无法连接到远程服务器---> System.Net.WebException:无法连接到远程服务器---> System.Net.Sockets.SocketException:尝试访问以受System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress)在System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,Socket s4,Socket s6,套接字和套接字,IP地址和地址,ConnectSocketState状态,IAsyncResult asyncResult,Exception&异常)
在第一步的日志记录中,我们尝试连接到Azure存储。
我想念什么吗?我是否为WebJobs正确设置了连接字符串?如何为开发人员将它们设置为默认存储在本地存储中,但在Azure中运行的应用程序具有真实的连接字符串?
首先,我确信Azure门户中的配置比web.config/app.config中的配置具有更高的优先级。
根据您上传的图片,我看到您为 Azure 存储连接字符串选择了事件中心和 SQL 数据库类型。如果您为 Azure 存储连接字符串选择事件中心类型,则会出现一些问题,请将连接类型更改为自定义来解决此问题。
您可以打印出 WebJob 中的连接字符串来确认。
var host = new JobHost(config);
Console.WriteLine(config.DashboardConnectionString);
Console.WriteLine(config.StorageConnectionString);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
855 次 |
| 最近记录: |