Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

Application content when deploying

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. Hi,

    Happy to help with your questions:

    1. Yes you can enable file system write access to create files and folders in your application's root folder. File system write access can be enabled on the application's "Settings" page.
    2. You're right, the files you write (to either App_Data or 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.
    3. The files in your Content files 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 the Build Action property to Content. 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. 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. I'd assume that's because the files aren't copied to the output directory as expected. Can you verify that the Build Action is 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. It worked. Thank you very much and have a good day.

  5. Great, glad it worked out!

    Best,
    Rune

  6. rune closed this discussion on 22 Jan, 2015 04:45 PM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac