I have created a new WorkerRole using the template for a QueueWorkerRole in VS 2013 and it creates code that looks like this:
// Create the queue if it does not exist already
var connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
if (!namespaceManager.QueueExists(QueueName))
{
namespaceManager.CreateQueue(QueueName);
}
// Initialize the connection to Service Bus Queue
_client = QueueClient.CreateFromConnectionString(connectionString, QueueName);
The problem I ma having is setting the Microsoft.ServiceBus.ConnectionString correctly so that it will work with my local development queues running in the emulator. By default it sets it up like this:
<appSettings>
<!-- Service Bus specific app setings for messaging connections -->
<add key="Microsoft.ServiceBus.ConnectionString" value="Endpoint=sb://[your namespace].servicebus.windows.net;SharedSecretIssuer=owner;SharedSecretValue=[your secret]" />
</appSettings>
And I'm guessing this will work fine when I have a hosted service to connect to but I am just trying out some things locally and can't get it to connect.
I have tried "UseDevelopmentStorage=True" and I've tried using the address I found when viewing the Storage Emulator UI "127.0.0.1:10001" as well as the Local Emulator using Standard Format I found here: http://www.connectionstrings.com/windows-azure/ (DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;
AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;) but I am having no luck.
Sometimes I am seeing "The Service Bus connection string contains invalid property" in the Compute Emulator UI and other times I get an error that it can't connect.
Thanks.
The problem you are having here is that you are attempting to plug a queue connection string into a Service Bus Connection String Creator. Those two connection strings are inherently different.
To use development storage you need to set the value of the app setting key you wish to use to: "UseDevelopmentStorage=true" as seen in this stack overflow:
Windows Azure Storage Emulator Connection String for ASP.NET MVC? This will work for STORAGE (not service bus)
Related
Im Using Microsoft.Azure.ServiceBus 5.1.3
var topic = new TopicClient("UseStorageDevelopment=true", anyObject)
The reason you are getting this error is because you are trying to use Storage Emulator for Service Bus.
Storage Emulator works with Azure Storage services (Blobs, Queues and Tables) and Storage Queue is different than Service Bus Queue.
You would need to use a real Service Bus Namespace (there's no emulator support for Service Bus) and use its connection string in your code. Your connection string would look something like Endpoint=sb://foo.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xxxxx==
I'm using "ServiceStack.Redis" to connect to Redis and it works correctly on my development machine.
Basically, I open the connection via this line:
client = new RedisClient(host);
Where host, on my development machine, is "localhost".
Now, I'd like to upload my application to Azure, so I created a cache in Azure and I'm trying to connect to it by passing the following connection string:
XXX.redis.cache.windows.net,ssl=false,password=YYY
The creation of the "RedisClient" seems to work but when I try to perform an operation (the first one to be executed being client.RemoveByPattern("...")), I get the following error:
Exception Details: System.Net.Sockets.SocketException: No such host is
known
Note that I allowed the cache to be connected to via HTTP, so normally, the port 6379 is unblocked and accessible.
All the example I found over Internet are using "ConnectionMultiplexer" but this class does not seem to be found in the NuGet package "ServiceStack.Redis".
What am I doing wrong?
I was having the same(similar?) issue connecting to Azure Redis with ServiceStack, in the end it was working out the correct syntax for the connection that worked for me. XXX.redis.cache.windows.net?ssl=true
Found some help here https://github.com/ServiceStack/ServiceStack.Redis, but to quote the connection strings section had examples;
"Redis Connection strings have been expanded to support the more versatile URI format which is now able to capture most of Redis Client settings in a single connection string (akin to DB Connection strings).
Redis Connection Strings supports multiple URI-like formats, from a simple hostname or IP Address and port pair to a fully-qualified URI with multiple options specified on the QueryString."
Some examples of supported formats:
localhost
127.0.0.1:6379
redis://localhost:6379
password#localhost:6379
clientid:password#localhost:6379
redis://clientid:password#localhost:6380?ssl=true&db=1
NOTE: I used the final example here but without the redis:// bit as I found this was not needed in Azure.
I am trying a Cloud application using Raspberry Pi 3 with Windows 10 IOT Core.
I have already completed a Universal App which collects data and messages it to the cloud, which is functional.
Next, I try to write a little Application to receive these messages from Azure using the Message Bus.
I have registered my device in Azure (trial version) and got some connection strings and Ids. I use this same connection string to connect to the event message service:
string IotHubUri = "HostName=<My>Hub.azure-devices.net;DeviceId=<MyRaspiPC>;SharedAccessKeyName=iothubowner;SharedAccessKey=<The primary key>"
string iotHubD2cEndpoint = "messages/events";
EventHubClient client = EventHubClient.CreateFromConnectionString(
IotHubUri,
iotHubD2cEndpoint);
The IotHubUri string originally had no "SharedAccessKeyName" in it, I filled it in after getting an exception telling me that there is missing information.
With this KeyName provided, I get another Exception
Hostname could not be parsed
Since I am using the same pattern as I have found in all books and other information I found on the Internet, I am simply stunned and have no idea how to go on.
I'm trying to implement an MQ Listener in a windows service and I have used the xms mq consumer sample provided in the dotnet folder from the MQ Explorer installation. I am using MQ WebSphere 7.1
If I run their sample solution in console, everything works.
However, in my windows service it fails with MQ Reason Code: 2063.
I'm using these settings for my factory
cf.SetStringProperty(XMSC.WMQ_HOST_NAME, _queueHost);
cf.SetIntProperty(XMSC.WMQ_PORT, Convert.ToInt32(_queuePort));
cf.SetStringProperty(XMSC.WMQ_CHANNEL, "SYSTEM.DEF.SVRCONN");
cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED);
cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, _queueChannel);
cf.SetIntProperty(XMSC.WMQ_BROKER_VERSION, 0);
and then this line seems to be failing
IConnection connection = cf.CreateConnection(null,null);
I don't want to provide any user credentials, is that possible?
I've tried changing the CONNECTION_MODE to bindings and getting different errors as well.
Is the sample code only working because I am running it and therefore it is using my local credentials by default? Otherwise I am using the same config in both.
The MQ XMS client is propagating the logged on user to the queue manager, then the QM checks its authority records to determine whether that user can connect and what objects it may access.
You could set the authority records to allow the user currently used to run the service, or you could set the logged on user on the windows service to match an allowed user of the queue manager, or set the MCAUSER property on the server connection channel used to connect to the queue manager, if you use client connection.
Setting the MCAUSER on the server connection channel will allow anyone who can connect to that channel to impersonate the set user, so this should be used with caution, possibly with setting appropriate channel authentication records.
References:
http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.msc.doc/xms_rtrouble_tips.html
https://www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.sec.doc/q010530_.htm
Trying to connect to a windows azure queue from a windows service (ie. not running in azure, just on my desktop, for now, but eventually on a self-hosted windows server).
The connection string generated by the dashboard is in the following form:
Endpoint=sb://MyServiceBus.servicebus.windows.net/;SharedAccessKeyName=MySasName;SharedAccessKey=*****
I'm trying to initialize the CloudStorageAccount, but am receiving a format exception (as noted in the title).
string str = ConfigurationManager.AppSettings["StorageConnectionString"];
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
str);
This seems to match all of the documentation ... can anyone clear up what might be going on?