How to Distribute Folders by Deploying Windows azure WebSite?

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

Sometimes there are situations when your Windows Azure Web Site is requiresdto read or write some files to/from folders which are directly below your site root.
For example if you want to persist some temporary created data or similar. To illustrate this requirement take a look on following picture:

image 
When this application is deployed on the web server the folder ‘Temp” will not exist. Usually your web site is deployed on location which looks like:

C:\DWASFiles\Sites\YOURAPPNAME\VirtualDirectory0\site\wwwroot\”

Everything from you project folder structure will be deployed here.Almost everything, because folder ‘Temp’ and possibly some other folders will not be deployed.
If you execute following statement

     Directory.Exists(@"C:\DWASFiles\Sites\YOURAPPNAME\VirtualDirectory0\site\wwwroot\Temp")

you will get back FALSE, which obviously means that this folder does not exist. Deployment process will not deploy the folder if it is empty.
The solution is easy. As in most other project types you need to add a file in the folder and set it as a content of your application:

image


Posted Jan 21 2014, 06:29 AM by Damir Dobric
Filed under: , ,
developers.de is a .Net Community Blog powered by daenet GmbH.