Hi All!
I have problem with netMessagingBinding and can't setup it.
I have WCF service in worker role and client code that used it.
This is how I start my service host:
Uri uri = ServiceBusEnvironment.CreateServiceUri("sb", "#NAMESPACE#", "#PATH#");
ServiceHost host = new ServiceHost(typeof(AnswerOneWay), uri);
ContractDescription contractDescription = ContractDescription.GetContract(typeof(IAnswerContractOneWay), typeof(AnswerOneWay));
ServiceEndpoint endpoint = new ServiceEndpoint(contractDescription)
{
Address = new EndpointAddress(uri),
Binding = new NetMessagingBinding
{
SendTimeout = TimeSpan.FromMinutes(3),
ReceiveTimeout = TimeSpan.FromMinutes(3),
OpenTimeout = TimeSpan.FromMinutes(3),
CloseTimeout = TimeSpan.FromMinutes(3),
TransportSettings = new NetMessagingTransportSettings { BatchFlushInterval = TimeSpan.FromSeconds(1) },
},
};
endpoint.Behaviors.Add(new TransportClientEndpointBehavior
{
TokenProvider = TokenProvider.CreateSharedSecretTokenProvider("owner", "#KEY#")
});
host.Description.Endpoints.Add(endpoint);
if (host.Description.Behaviors != null)
{
foreach (ServiceDebugBehavior behavior in host.Description.Behaviors.OfType<ServiceDebugBehavior>())
{
(behavior).IncludeExceptionDetailInFaults = true;
}
}
host.Open();
Here is my system.serviceModel section
<system.serviceModel>
<extensions>
<bindingElementExtensions>
<add name="netMessagingTransport" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingTransportExtensionElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</bindingElementExtensions>
<bindingExtensions>
<add name="netMessagingBinding" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingBindingCollectionElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</bindingExtensions>
<behaviorExtensions>
<add name="transportClientEndpointBehavior" type="Microsoft.ServiceBus.Configuration.TransportClientEndpointBehaviorElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</behaviorExtensions>
</extensions>
<behaviors>
<endpointBehaviors>
<behavior name="securityBehavior">
<transportClientEndpointBehavior>
<tokenProvider>
<sharedSecret issuerName="owner" issuerSecret="#KEY#" />
</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">
<transportSettings batchFlushInterval="00:00:01" />
</binding>
</netMessagingBinding>
</bindings>
<client>
<endpoint name="QuestionsService.Answers.MSMQ"
address="sb://#NAMESPACE#.servicebus.windows.net/#QUEUE#"
binding="netMessagingBinding"
bindingConfiguration="messagingBinding"
behaviorConfiguration="securityBehavior"
contract="QuestionsServiceOneWay.Contracts.IAnswerContractOneWay" />
</client>
</system.serviceModel>
Here is my error whe I try use it:
EXCEPTION: Message: A user callback threw an exception. Check the exception stack and inner exception to determine the callback that failed. Method: Void OnFaulted() Source: System.ServiceModel
Exception type: System.Runtime.CallbackException Stack trace: at System.ServiceModel.Channels.CommunicationObject.OnFaulted() at System.ServiceModel.Channels.CommunicationObject.Fault()
at System.ServiceModel.Channels.ServiceChannel.OnInnerChannelFaulted(Object sender, EventArgs e) at System.ServiceModel.Channels.CommunicationObject.OnFaulted() at System.ServiceModel.Channels.CommunicationObject.Fault()
at Microsoft.ServiceBus.Messaging.Channels.ServiceBusOutputChannel.Send(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at QuestionsServiceOneWay.Contracts.IAnswerContractOneWay.SaveComment(Int64 senderID, Int64 answerID, CommentType type)
at Questions.App.Web.Controllers.AnswerCommentController.OnProcess(HttpContext context) in D:\Max\Work\Projects\Applications\Web\Questions.App\Web\Controllers\AnswerCommentController.cs:line 40 at Questions.App.Web.Controllers.BaseController.Process(HttpContext
context) in D:\Max\Work\Projects\Applications\Web\Questions.App\Web\Controllers\BaseController.cs:line 41 at Questions.App.Web.WCFHttpHandler.ProcessRequest(HttpContext context) in D:\Max\Work\Projects\Applications\Web\Questions.App\Web\WCFHttpHandler.cs:line
85 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)