Deploying NServiceBus sample to cloud fails due to use of App_Data?

474 Views Asked by At

I am using the sample from here

NService Bus Sample

and trying to deploy to Azure

I get the error below

Has anyone got any idea how to fix this?

The code they suggest in the message does not compile (LogManager.use is not valid)

Detected running in a website and attempted to use HostingEnvironment.MapPath("~/App_Data/") to derive the logging path. Failed since path returned (D:\home\site\wwwroot\App_Data) does not exist. Ensure this directory is created and restart the endpoint.. To avoid using HostingEnvironment.MapPath to derive the logging directory you can instead configure it to a specific path using LogManager.Use().Directory("pathToLoggingDirectory")

To be honest, this is probably more complicated than I need but I am really struggling with NServiceBus and Azure at the moment. I just want to get a simple example where I have any application that uses NService bus working in the cloud!

Any other examples would be gratefully received as this is now doing my head in lol

Am getting dead ends everywhere

Paul

2

There are 2 best solutions below

0
On

The default for web applications is indeed ~/App_Data. If it's not available, you could create it locally and deploy as part of your application. Alternatively, as the error suggest, provide your own path via configuration.

The code they suggest in the message does not compile (LogManager.use is not valid)

That sounds off. LogManager is part of NServiceBus core assembly and should be available. There's a logging specific sample, try it first to see if you can configure logs location. The same code then would work for a web application.

0
On

To fix this error, I did something similar to what @Sean Feldman suggested.

  • I created a dummy.txt file.

enter image description here enter image description here enter image description here