0

I am trying to make a windows application in WPF that needs to send messages to Azure queue that belongs to other cloud application. Later a worker role will extract those messages from the queue and make some manipulation on the data.

  • Is it even possible or do I have to use a cloud application with a web role?
  • If it is, can someone point me to a good reading source on how to do it?
  • If its not, how can I make a windows executable app that uses Azure queues?

edit: this is my code, I included this:

using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
using Microsoft.WindowsAzure.ServiceRuntime;


var storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
var queue = storageAccount.CreateCloudQueueClient();

I get this exception:

SetConfigurationSettingPublisher needs to be called before FromConfigurationSetting can be used

I've tried to look up this exception but didn't find a normal solution. Every post is talking about an azure cloud application while I'm trying to do it from WPF.

4

2 回答 2

1

你可以从任何地方向 Azure 队列发送消息,只要你有适当的权限即可。我假设您正在谈论存储队列(与服务总线队列相比):您需要存储帐户密钥或队列的共享访问签名。那时,您可以从任何您想要的应用程序编写消息。

只需创建队列客户端,创建您的消息,然后将消息添加到队列中。如果您的应用程序在本地、移动设备或与存储队列的存储帐户不同的数据中心运行,则添加消息时会有一点延迟,但除此之外,工作正常。

于 2014-02-20T12:11:02.220 回答
0

在朋友的帮助下,我设法使它工作。这就是我所做的:

添加参考System.Configuration以使用ConfigurationManager

添加到 App.Config:

<appSettings> <add key="StorageConnectionString" value="UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1:10001/"/> </appSettings>

为了连接到本地存储帐户:

CloudStorageAccount st = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"].ToString());

希望它可以帮助其他遇到同样问题的人!

于 2014-03-13T12:50:42.777 回答