0

We're currently building a WebService that will run under IIS. Our current dilemma is where to store uploaded files?

Up until now we saved the files directly under the physical path of the virtual directory but than we found out that the application pool restarts when files are deleted under one of its physical paths.

We think of storing the files under the ProgramData folder but we're afraid of breaking changes with new windows updates.

Where would be a correct and safe place to store the files? Is the ProgramData good enough?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Lior Ohana
  • 3,467
  • 4
  • 34
  • 49

2 Answers2

1

I really dont understand why you are putting this files directly in the root? just create a folder called Files instead and put your files there. then your application pool doesnt restart:)

or else read up how to create your own mini-CDN:) http://www.saotn.org/create-cdn-using-iis-outbound-rules/

and DONT use the programdata.it is designed for userdata and not to drive your webpage

Softwarehuset
  • 815
  • 4
  • 10
  • We already created a directory for the uploaded content. It didn't solve the problem. What do you mean by "designed for userdata". For what I know the progdata is used to save programs configuration and data. Isn't it? – Lior Ohana Dec 29 '13 at 13:57
  • It is for local data. Web should Always Be independent from the system – Softwarehuset Dec 29 '13 at 19:41
  • What do you mean by local data? Do you count uploaded files as local data? – Lior Ohana Dec 30 '13 at 21:52
  • The ProgramData folder contains all your application data, like program settings, user data, etc, for all of the installed programs on the computer. An MVP answer. It a webapplication is not considered as an installed program. A webapplication should be a standalone software not depending on anything else than the IIS and the code alone. – Softwarehuset Dec 30 '13 at 22:01
1

Really? Deleting a file restarts the application pool? What are you doing with these file? Are they resources of your application? Basically saving the files in any partition different from the system's partition should be fine. Even saving them in a folder inside your application's physical path...deleting the files shouldn't cause the application pool to recycle. But, a safer solution would be to save them in a separate server if you happen to need several instances of your web service in a load balanced environment

Leo
  • 14,625
  • 2
  • 37
  • 55
  • Yep, really. Take a look at these SOs: http://stackoverflow.com/questions/12244530/application-restart-for-folder-deleted-added-updated or http://stackoverflow.com/questions/502743/asp-net-deleting-a-directory-results-in-application-restart – Lior Ohana Dec 29 '13 at 13:56
  • Are you trying to delete resource files? If so, of course the app pool will recycle that's why I asked initially in my answer. Also, what do you mean by `we saved the files directly...`...do you mean you published your application files in the apps physical path? – Leo Dec 29 '13 at 14:32
  • I just noticed your comment in the other answer so I'll reinstate that deleting uploaded content should not recycle your app pool – Leo Dec 29 '13 at 14:34