Hi,
I'm using Bitbucket to deploy my apps to your service, and I have few problems / questions.
1. Am I able to create folder in the root of the app? (On my localhost I am using Server.MapPath("~/Photos") to get the path of that folder, and if it does not exists, I create it ). But when I deploy app to appharbor, it says that I don't have permissions to write or create that folder. Is that normal?
2. Because of first problem, I created folder inside of App_Data called images, and that works very well. Anyway, my app is uploading images to that folder and reading from it. But when I re-deploy ( make commit to my bitbucket repo ), all those files are gone. Is that normal too, or am I missing something?
3. And last, I have some images in my Content folder ( where css is ), but how can I access them?
It would be very helpful if you answer my question.
#1 Posted by rune Support staff on 21 Jan, 2015 10:02 AM
Hi,
Happy to help with your questions:
App_Dataor the root folder when write access is enabled) are wiped on subsequent deployments. This also means it should only be used for temporary files, caches etc. If you need to persist files I'd recommend using a cloud storage solution such as Amazon S3. S3 have good .NET libraries that makes it easy to accomplish pretty much any file-related tasks in a scalable and "cloud-ready" manner.Contentfiles should be accessible in the same way you usually use them. However you have to make sure they're copied to the build output directory when you application is built - for instance by referencing the files and setting theBuild Actionproperty toContent. You can also download the build artifact on the build log pages to verify that the files are copied and deployed as you' expect.I hope this helps!
Best,
Rune
#2 Posted by kcrnac on 21 Jan, 2015 06:05 PM
Thank you very much, you helped me a lot. Just one more thing about the third problem:
The thing is that I'm referencing image from Content folder in my css ( as background ) which is also in Content folder. On my localhost it's working very good but when deployed it' can not find a file.
Can you just tell me if this is the right way to do it?
Folder structure
----------------------
Content/ a17.png
Content/ style.css
style.css
------------
background: url(/Content/a17.png) no-repeat;
#3 Posted by rune Support staff on 22 Jan, 2015 01:58 PM
I'd assume that's because the files aren't copied to the output directory as expected. Can you verify that the
Build Actionis properly set on the file reference, and that the file is copied to the output directory? Otherwise let me know the name of the application and I can take a closer look.Best,
Rune
#4 Posted by kcrnac on 22 Jan, 2015 02:56 PM
It worked. Thank you very much and have a good day.
#5 Posted by rune Support staff on 22 Jan, 2015 04:45 PM
Great, glad it worked out!
Best,
Rune
rune closed this discussion on 22 Jan, 2015 04:45 PM.