简体   繁体   English

Azure WebJob存储连接

[英]Azure WebJob Storage Connection

I have these connection strings in my App.config for an Azure WebJob 我在App.config中为Azure WebJob提供了这些连接字符串

<add name="AzureWebJobsDashboard" connectionString="UseDevelopmentStorage=true"/>
<add name="AzureWebJobsStorage" connectionString="UseDevelopmentStorage=true"/>

because I want it to default to Azure Storage Emulator for developers. 因为我希望它为开发人员默认为Azure存储模拟器。 However, when these WebJobs are used on Azure, they seem to still point to local storage, despite the fact that I've set these connection strings in the Azure Portal interface: 但是,当在Azure上使用这些WebJobs时,尽管我在Azure门户界面中设置了这些连接字符串,但它们似乎仍指向本地存储:

Azure门户应用程序设置连接字符串

I'm inferring it is still pointing to local storage because I get this error: 我推断它仍指向本地存储,因为我收到此错误:

Microsoft.WindowsAzure.Storage.StorageException: Unable to connect to the remote server ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:10001 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) Microsoft.WindowsAzure.Storage.StorageException:无法连接到远程服务器---> System.Net.WebException:无法连接到远程服务器---> System.Net.Sockets.SocketException:尝试访问在System.Net.Service.ConnectSocketInternal的System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress)中以其访问权限127.0.0.1:10001禁止的方式的套接字(Boolean connectFailure,Socket s4,Socket s6,套接字和套接字,IP地址和地址,ConnectSocketState状态,IAsyncResult asyncResult,异常和异常)

in our logging right at the first point we try to connect to Azure Storage. 在我们的第一点登录时,我们尝试连接到Azure存储。

Am I missing something? 我错过了什么吗? Have I set up the connection strings properly for WebJobs? 我是否为WebJobs正确设置了连接字符串? How can I set them up to default to local storage for developers but have a real connection string for the app running in Azure? 如何为开发人员将它们设置为默认为本地存储,但是为Azure中运行的应用程序提供了真正的连接字符串?

Firstly, I am sure that configurations in Azure portal have higher priority than configurations in web.config/app.config. 首先,我确信Azure门户中的配置优先于web.config / app.config中的配置。

According to image you uploaded, I saw that you chosen Event Hub and SQL Database types for your Azure Storage connection strings. 根据您上传的图像,我看到您为Azure存储连接字符串选择了Event Hub和SQL Database类型。 It will have some issues if you choose Event Hub type for Azure Storage connection string, please change the connection type to Custom to fix this issue. 如果为Azure存储连接字符串选择事件中心类型,则会出现一些问题,请将连接类型更改为自定义以解决此问题。

在此输入图像描述

You could print out the connection strings in your WebJob to confirm it. 您可以在WebJob中打印出连接字符串以进行确认。

var host = new JobHost(config);

Console.WriteLine(config.DashboardConnectionString);
Console.WriteLine(config.StorageConnectionString);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM