Reputation: 104
I built an ASP.NET Core api application it is deployed to Azure web api app. In the code, I try at some point to read the contents of a file in content root, interpolating certain place holders for their actual values.
Now on my local system this works just fine cause it is able to get the exact file path of the file but in the cloud, I get an exception with the following message:
Could not find a part of the path...
I get the full file path like so:
Path.Combine(hostingEnvironment.ContentRootPath, "containing directory\filename")
But this fails in the cloud. Are there extras I should know about deploying this or what am I doing wrong with respect to understanding directory structuring in cloud deployment?
N.B I could store this file in an Azure file storage container but I feel it will be too much hassle to read it plus the cost seeing this file will be read quite often.
Upvotes: 3
Views: 8575
Reputation: 24529
Could not find a part of the path...
According to the exception, it indicates that there is no related path in the Azure. If it is possible, we could remote debug Azure Web Apps. Then we could get the file path. After that we could use the Azure kudu(https://yoursite.scm.azurewebsites.net) tool to check whether the path is existing.
If the file path is not existing, we could drag the folder to kudu tool directly or we also could publish the folder with Visual Studio. After that it should work.
We could get more info about Azure Web App sandbox. About Azure website file structure please refer the document
/
LogFiles
Application
<instance>-<pid>-<ticks>.txt // application (nodejs/dotnet/php) traces
DetailedError
ErrorPage####.htm // error details
Git
trace
trace.xml // Trace generated during git deployments
<instance>-<guid>.txt // kudu related traces
deployment
<instance>-<guid>.txt // deployment related traces
http
RawLogs
<logfile>.log // iis http log. iis buffers and flushes every 60sec.
W3SVC#####
fr####.xml // IIS fail request traces
freb.xsl
site
wwwroot
hello.htm // The files that are live in your app
repository // Your repo, including working files (i.e. not bare)
.git
HEAD, index and other git files
deployments
[commit id 1]
log.xml // The deployment log, similar to what the protal shows
status.xml // The status of the deployment (success/failure)
manifest // The list of files that were deployed
[commit id 2]
...
.ssh
config // This contains config to disable strict host checking
id_rsa // private key in PEM format
known_hosts // known hosts have been accepted
Data
Jobs
Triggered
MyTriggeredJob1
20131112101559
output.log
error.log
status
Continuous
MyContinuousJob1
job.log
status
SiteExtensions
// TODO: add details here
Upvotes: 5