NServicebus failing to forward failed message to error queue - msmq

I am running into issues with forwarding failed messages to error queue as ISendMessages was not configured.
I have the following sections in my app.config file
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
<MessageForwardingInCaseOfFaultConfig ErrorQueue="nservicebus_error" />
<add key="ConnectivityRetryPeriod" value="30" />
<add key="FatalRetryCount" value="2" />
<add key="RetryFrequency" value="2" />
However, when the FatalRetryCount is exceeded, I get the following exception
System.InvalidOperationException occurred
Message=Could not forward failed message to error queue, reason: System.ArgumentException: NServiceBus.Unicast.Queuing.ISendMessages has not been configured. In order to avoid this exception, check the return value of the 'HasComponent' method for this type.
at NServiceBus.ObjectBuilder.Spring.SpringObjectBuilder.NServiceBus.ObjectBuilder.Common.IContainer.Build(Type typeToBuild)
at NServiceBus.ObjectBuilder.Common.CommonObjectBuilder.NServiceBus.ObjectBuilder.IBuilder.Build[T]()
at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, String reason).
Source=NServiceBus.Core
StackTrace:
at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, String reason)
InnerException: System.ArgumentException
Message=NServiceBus.Unicast.Queuing.ISendMessages has not been configured. In order to avoid this exception, check the return value of the 'HasComponent' method for this type.
Source=NServiceBus.ObjectBuilder.Spring
StackTrace:
at NServiceBus.ObjectBuilder.Spring.SpringObjectBuilder.NServiceBus.ObjectBuilder.Common.IContainer.Build(Type typeToBuild)
at NServiceBus.ObjectBuilder.Common.CommonObjectBuilder.NServiceBus.ObjectBuilder.IBuilder.Build[T]()
at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, String reason)
In specific, this exception is logged in the following lien in the FaultManager.cs in the NServiceBus.Faults.Forwarder namespace
Here is the App.Config section and the Config code that I use

Got the fix to this issue from the NServiceBus support team and it looks like the ISendMessages gets registered when I explicitly call .MsmqTransport(). I updated the config code to call .MsmqTransport() and FaultManager stopped throwing this exception

Related

Service doesnot start - ArgumentNullException value cannot be null parameter name ip

Service does not start - ArgumentNullException value cannot be null parameter name ip.
My Service does not start and I see following exception in the EventViewer.
Service cannot be started. System.Runtime.Remoting.RemotingException: Remoting configuration failed with the exception 'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: ip
at System.Runtime.Remoting.Channels.CoreChannel.GetMachineIp()
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupMachineName()
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictionary properties, IServerChannelSinkProvider sinkProvider, IAuthorizeRemotingConnection authorizeCallback)
at System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
When I debug, the exception happened at line :
-> RemotingConfiguration.Configure(configFile, false);
My configfile Remoting Configuration is as below:
<system.runtime.remoting>
<application>
<service>
<wellknown mode="Singleton" objectUri="PersonalityModule.rem" type="Ideas.Instructor.PersonalityModules.SPPA.PersonalityModule, PM_SPPA"/>
</service>
<channels>
<channel ref="tcp" port="7676" >
<formatter ref="binary" typeFilterLevel="Full" />
</channel>
</channels>
</application>
<customErrors mode="Off"/>
</system.runtime.remoting>
I have limited knowledge on Remoting. I am not understanding what is causing this error and how to fix it. Kindly suggest. Thank you in advance.

aEntities.savechange() not working

I'm using a Windows forms application with Entity Framework 5, all my model is constructed by entity (.edmx). That means for model creating it made a connection string in my app.config file:
<add name="PGDEntities"
connectionString="metadata=res://*/Model.ModelTest.csdl|res://*/Model.ModelTest.ssdl|res://*/Model.ModelTest.msl;provider=System.Data.SqlClient;provider connection string="data source=My-PC;initial catalog=DB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
My problem is that when I run my code on another computer then
aEntities = new PGDEntities();
aEntities.ModelName.Add(aModel);
aEntities.SaveChanges();
it throws an exception
An error occurred while updating the entries. See the inner exception for details.
It might be for the entity connection string, but I change my connection string to
<add name="PGDEntities"
connectionstring="metadata=res://*/Model.ModelTest.csdl|res://*/Model.ModelTest.ssdl|res://*/Model.ModelTest.msl;provider=System.Data.SqlClient;provider connection string="data source=MyOther-PC;initial catalog=DB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework""
providername="System.Data.EntityClient" />
But it wouldn't go forward.
Can any one explain the problem or the solution. Because when I want to deploy it in user side then it will occur again for sure. I can't figure it out, please anyone help me

Could not forward the failed message to error queue

When an exception occurs in the code that's called from the handler, the host tries it for 5 times and then shuts down the service with the following message:
2013-10-17 08:57:12,091 [13] FATAL NServiceBus.Faults.Forwarder.FaultManager [(null)] - Could not forward failed message to error queue.
Autofac.Core.Registration.ComponentNotRegisteredException: The requested service 'NServiceBus.Transports.ISendMessages' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
2013-10-17 08:57:12,139 [13] FATAL NServiceBus [(null)] - Fault manager failed to process the failed message with id e0fc75b2-4eef-4f90-a450-a25901130c9a
System.InvalidOperationException: Could not forward failed message to error queue. ---> Autofac.Core.Registration.ComponentNotRegisteredException: The requested service 'NServiceBus.Transports.ISendMessages' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
Here's my config:
<configSections>
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
<UnicastBusConfig ForwardReceivedMessagesTo="audit">
<MessageEndpointMappings />
</UnicastBusConfig>
Here's my Bus initialization code:
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, AsA_Publisher, UsingTransport<Msmq>
{
}
NServiceBus.SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure);
NServiceBus.Unicast.Config.ConfigUnicastBus busConfig = Configure.With()
.Log4Net()
.DefaultBuilder()
.MsmqSubscriptionStorage()
.UnicastBus();
Bus = busConfig.CreateBus().Start(() => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install());
I am not quite sure why it is not able to try the SLR after failing 5 times and also forwarding it to the error queue after that.
Any help is appreciated!
Thanks
Prasad
Take a look here: https://github.com/sfarmar/Samples/tree/master/HalloWorldWithPubSub
I'm hoping this can guide you in the right direction

Azure deployment with 2 websites is cycling for a long time

I'm deploying with azure in visual studio 2010 and I have this problem when I have 2 websites.
With only 1 website the deploy runs sucessfully.
Help!!!!!!!!!
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="RIS2048.ConsultaClick.Web.Azure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="RIS2048.ConsultaClick.Web" vmsize="Small">
<Sites>
<Site name="PT" physicalDirectory="..\RIS2048.ConsultaClick.WWWPacientes">
<VirtualDirectory name="images" physicalDirectory="..\RIS2048.ConsultaClick.WWWPacientes\imgpt" />
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" hostHeader="pt.consultaclick.com" />
</Bindings>
</Site>
<Site name="RO" physicalDirectory="..\RIS2048.ConsultaClick.WWWPacientes">
<VirtualDirectory name="images" physicalDirectory="..\RIS2048.ConsultaClick.WWWPacientes\imgro" />
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" hostHeader="ro.consultaclick.com" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InternalEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
</Imports>
</WebRole>
</ServiceDefinition>
After using intellitrace and remote desktop found the following in event viewer:
https://picasaweb.google.com/112383217404623421937/Dropbox#
In system section:
NtpClient was unable to set a manual peer to use as a time source because of DNS resolution error on 'time.windows.com,0x9'. NtpClient will try again in 15 minutes and double the reattempt interval
thereafter. The error was: No such host is known. (0x80072AF9)
VSP rejected attempt to use protocol version '3.2'.
The application '/' belonging to site '1' has an invalid AppPoolId 'DefaultAppPool' set. Therefore, the application will be ignored.
Site 1 was disabled because the root application defined for the site is invalid. See the previous event log message for information about why the root application is invalid.
Error communicating with the Spooler system service. Open the Services snap-in and confirm that the Print Spooler service is running.
The SLUINotify service terminated with the following error:
The specified module could not be found.
Azure section:
An unhandled exception occurred. Process ID: 3024
Process Name: WaIISHost
Thread ID: 1
AppDomain Unhandled Exception
Exception: E:\sitesroot\3
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IConfigurator.Deploy(String roleId, WebAppModel webAppModelPath, String roleRootDirectory, String sitesDestinationRootDirectory, String diagnosticsRootDirectory, String roleGuid, Dictionary2 globalEnvironment)
at ConfiguratorClient.Deploy(String roleId, WebAppModel webAppModelPath, String roleRootDirectory, String sitesDestinationRootDirectory, String diagnosticsRootDirectory, String roleGuid, Dictionary2 globalEnvironment)
at Microsoft.WindowsAzure.Hosts.WaIISHost.Program.Main(String[] args)
You should try to figure out what is causing the issue. Could you try configuring Remote Desktop and connect to one of your instance? Verify the Event Viewer to see if you have any errors or warnings in the Application log.
In these situations I often experienced a disconnect from the Remote Desktop session because of the cycling, but you should still try it and with a little luck you'll be able to find out the cause of the issue.
Alternatively you could try configuring the DiagnosticsManager to ship the Windows logs ever 1 minute to track down the issue.
The problem was that I was parsing the request on host header (pt.example.com) and accessing from cck.azure.com so the host header was invalid (I should access from pt.example.com and have a domain that I bought redirecting pt.example.com to cck.azure.com).......

NServiceBus Failed raising Transport Message Received event

Scenario:
I'm using NServiceBus with MSMQ Transport.
I have messages from an app dropped into QUEUE-A.
I have a NServiceBus Gateway grab messages from QUEUE-A and send them to another Gateway
I the Destination Gateway receives the messages and places them into the respective queue.
Source Gateway throws a Null Reference Exception and send the messages 5 total times (max retries).
Destination Gateway receives all messages and shows that it's Sending the HTTP response in the log.
The error that the Destination Gateway throws is:
WARN NServiceBus.Unitcast.Transport.Msmq.MsmqTransport [(null)] <(null)> - Failed raising 'transport message received' event for message with ID=GUID
System.NullReferenceException: Object reference not set to an instance of an object.
This error initially was setup on 2 different servers though it occurs when I run the scenario locally, under admin rights, on my local computer (just listening on different ports). I'm setting the SetHttpToHeader() of the message to the proper destination address.
The gateway configs are as follows:
Gateway1:
<appSettings>
<add key="NumberOfWorkerThreads" value="10"/>
<add key="InputQueue" value="Gateway1Pickup"/>
<add key="ErrorQueue" value="Gateway1Error"/>
<add key="ForwardReceivedMessageTo" value="audit"/>
<add key="OutputQueue" value="Gateway1Output"/>
<add key="ListenUrl" value="http://address:6768/Gateway/"/>
<add key="RequireMD5FromClient" value="true"/>
</appSettings>
Gateway2:
<appSettings>
<add key="NumberOfWorkerThreads" value="10"/>
<add key="InputQueue" value="Gateway2Pickup"/>
<add key="ErrorQueue" value="Gateway2Error"/>
<add key="ForwardReceivedMessageTo" value="audit"/>
<add key="OutputQueue" value="Gateway2Output"/>
<add key="ListenUrl" value="http://address:6768/Gateway/"/>
<add key="RequireMD5FromClient" value="true"/>
</appSettings>
Does anyone know where I'm going wrong on this?
At first I got a solid repro and then I realized that NSB does not handle creating the Audit queues for you. If you remove them from the config or create the Audit queues, you should be all set.
I found this above problem showed up when I didn't have some dependent assemblies in the service directory. I found the error attached to the message in the MSMQ queue. I used Queue Explorer, but I presume other tools would show the same.