I am building a POC for Azure Service Bus Topics using the code given on this blog post: http://blogs.msdn.com/b/tomholl/archive/2011/10/09/using-service-bus-topics-and-subscriptions-with-wcf.aspx However, I am getting following error.
System.TimeoutException: The request has timed out after 00:00:00 milliseconds. The successful completion of the request cannot be determined. Additional queries should be made to determine whether or not the operation has succeeded.
I have done everything as per the Link. Here is my Code, I receive error on this line: ((IChannel)clientChannerl).Open();
var accountEventLog = new AccountEventLog()
{
AccountId = 123,
EventType = "BE",
Date = DateTime.Now
};
ChannelFactory<IAccountEventNotification> factory = null;
try
{
factory = new ChannelFactory<IAccountEventNotification>("Subscribers");
var clientChannerl = factory.CreateChannel();
((IChannel)clientChannerl).Open();
using (new OperationContextScope((IContextChannel)clientChannerl))
{
var bmp = new BrokeredMessageProperty();
bmp.Properties["AccountId"] = accountEventLog.AccountId;
bmp.Properties["EventType"] = accountEventLog.EventType;
bmp.Properties["Date"] = accountEventLog.Date;
OperationContext.Current.OutgoingMessageProperties.Add(BrokeredMessageProperty.Name, bmp);
clientChannerl.onEventOccurred(accountEventLog);
}
((IChannel)clientChannerl).Close();
factory.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Here is my config settings
<behaviors>
<endpointBehaviors>
<behavior name="securityBehavior">
<transportClientEndpointBehavior>
<tokenProvider>
<sharedSecret issuerName="RootManageSharedAccessKey" issuerSecret="Shared Key Here" />
</tokenProvider>
</transportClientEndpointBehavior>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<netMessagingBinding>
<binding name="messagingBinding" sendTimeout="00:03:00" receiveTimeout="00:03:00"
openTimeout="00:03:00" closeTimeout="00:03:00" sessionIdleTimeout="00:01:00"
prefetchCount="-1">
<transportSettings batchFlushInterval="00:00:01" />
</binding>
</netMessagingBinding>
</bindings>
<client>
<endpoint name="Subscribers"
address="sb://Namespace/topicname"
binding="netMessagingBinding"
bindingConfiguration="messagingBinding"
contract="My Contract"
behaviorConfiguration="securityBehavior" />
</client>
Any help will be highly appreciated
I am able to resolve the issue. However, I am going to describe what I learned in this whole exercise.
In case you want to use ACS authentication then create namespace using Azure Power Shell. Following is the PS command to create Namespace with ACS Authentication enabled:
New-AzureSBNamespace "Namespace" "East US" -CreateACSNamespace $true -NamespaceType Messaging
So to resolve my issue I used the Point 3 described above and it started working.