App_Data directory not published with Azure Mobile Services

123 views Asked by At

I have a few fonts and a PDF file in the App_Data directory of my Web API project which is published to an Azure Mobile Service.

The build action is set to Content and I can see in the output window that the files are being published but when my code runs it cannot find the directory anywhere.

Assembly.GetExecutingAssembly().Location

Yields

"D:\\local\\Temporary ASP.NET Files\\root\\aea53938\\87de4b2f\\assembly\\dl3\\fb538bd2\\f38b146c_6ea3d001\\

Both of these

HostingEnvironment.ApplicationPhysicalPath
HostingEnvironment.MapPath("~/")

Yield

C:\\Program Files (x86)\\SiteExtensions\\MobileServicesDotNet\\1.0.450\\

If I do a Directory.GetFiles() and Directory.GetDirectories() using the directories above, none of them show an App_Data folder.

Where is this mystery folder located? Several Stackoverflow posts have suggested looking in bin\App_Data but it's not there either.

2

There are 2 answers

0
Paul Batum On

Try D:\home\site\wwwroot\App_Data

0
thorsten On

Make sure, that in VS Publish --> Settings the exclude option for App_Data is not set.