FATAL NServiceBus Failure to process messages

FATAL NServiceBus Failure to process messages
System.UnauthorizedAccessException: Access to the path is denied.

i have a simple setup with 2 console projects, one sends a command, the other handles, works fine.

I also have a web api, in the web api (local IIS, dev machine), i have the same console code in my global.asax file.
But when i run i get spammed with the same message, full stack trace below:

2017-12-14 15:58:28.699 FATAL NServiceBus Failure to process messages
System.UnauthorizedAccessException: Access to the path is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost)
at NServiceBus.DirectoryBasedTransaction.BeginTransaction(String incomingFilePath)
at NServiceBus.LearningTransportMessagePump.<InnerProcessMessages>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at NServiceBus.LearningTransportMessagePump.<ProcessMessages>d__6.MoveNext()
Event 7 was called with 5 argument(s) , but it is defined with 6 paramenter(s).

Anyone have an idea why this would happen? I can provide some code if required but its fairly simple beginner implimentation

Hi Steve,

The web project probably tries to write to path that it does not have permission to.

Try setting the destination manually as documented at the following location:

Does that help?

Regards,
Ramon

figured it was the app pool identity privelages that was causing the auth issue, but visual studio(2017) is spamming me with the “event 7” stuff thousands a second, anyone else seen this issue?

Do you have a screenshot or text output? I haven’t seen it before.

Are you still experiencing this “event 7” issue? Can you provide more details?

Seems like its an issue with the .net profiler in stackify, switched it off and no longer get the spam debug messages

Thanks for the update, maybe this can be of use in the future.

Hey Ramon,

I have the same problem. Could you tell me the way to resolve this problem?

Hi, Steve mentioned he resolved it in the following way:

Seems like its an issue with the .net profiler in stackify, switched it off and no longer get the spam debug messages

If you also use Stackify then switch it off and see if that resolves it for you too.

Regards,
Ramon

Thank you for your reply. But I’m not using Stackify :frowning:. It worked well on .net core console app, but the errors appeared when I’m trying to work with .net core web application.

Are you getting the same “Event 7” error? Please specify as much details as possible.

Hi Ramon,

I don’t know what is “Event 7” error. Sorry about that. I got only errors like:

2018-01-29 19:54:27.402 FATAL NServiceBus Failure to process messages
System.UnauthorizedAccessException: Access to the path is denied.
   at System.IO.Win32FileSystem.MoveFile(String sourceFullPath, String destFullPath)
   at System.IO.File.Move(String sourceFileName, String destFileName)
   at NServiceBus.AsyncFile.<Move>d__9.MoveNext() in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Transports\Learning\AsyncFile.cs:line 103
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.LearningTransportMessagePump.<InnerProcessMessages>d__7.MoveNext() in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Transports\Learning\LearningTransportMessagePump.cs:line 174

I’m using .net core 2.1.4 and NServiceBus 7 beta 0012.

Thank you

This indicates that your app pool identity does not have permissions to modify files/folders.

Perform one or more of the following to resolve your permission issue:

  • Recursively change permissions on the folder where the learning transport stores its data via the windows explorer.
  • Change the app pool to a different user that does have write access to the learning transport folder in IIS.
  • Select a different folder for the learning transport to store its data by adjusting the NServiceBus endpoint configuration as documented at the following location:

Does this help?

Regards,
Ramon

Hi Ramon,

I have just tried 3 ways but it did not help me resolve the problem.

  1. Change permission for project folder.
    1
  1. Change the app pool to “admin” user.
    3
  1. Configuration to another location.
    2

It looks like an error from app pool permission. This bug will have appeared when I run the application from IIS. If I run it from VS2017, it works well.

Thank you,
Nguyen

If your app pool its identity has write access to the folder C:\Data\project\Learn\test then you should not get this error.

Alternatively, you can use the following tool from Sysinternals and see what is denied. That tool should show the same errors but potentially you see more info.

Let me know if that helps. If you are still not able resolve your permission issue we might have to do a conference call.

Regards,
Ramon

Hi Ramon,

Sorry for late response. Thank you for your support. I resolved issue already.

Regards,
Nguyen