Is it advisable to store my own data as XML in the folder returned by
HttpRuntime.CodeGenDir?
(i.e. in "Temporary ASP.NET Files")
Each web service on the server must try to read its own cached file when it
(re)starts.
If it 's not present, it retrieves it from a remote service and caches it
locally.
If it's not advisable, what is the "best practice" for caching global
application data for a (web) service? 5 4187
It seems to me that if this is the approach you want to take, it would be
better to keep everything in the same place, e.g. writing the xml to the same
folder the webservice endpoint is in (Server.MapPath("myXmlFile.xml") )
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"ri****@nospam.nospam" wrote:
Is it advisable to store my own data as XML in the folder returned by
HttpRuntime.CodeGenDir?
(i.e. in "Temporary ASP.NET Files")
Each web service on the server must try to read its own cached file when it
(re)starts.
If it 's not present, it retrieves it from a remote service and caches it
locally.
If it's not advisable, what is the "best practice" for caching global
application data for a (web) service?
Hello Richlm,
for global data in ASP.NET webservice, there are several options for you to
persist it. For example, using disk file, using in memory cache, or using
database. If the data won't be quite large that will affect your server's
memory pressure, using in-memory cache would be most efficient. For file
based cache storage, I don't think the HttpRuntime.CodeGenDir (temporary
folder of ASP.NET) is preferred since it is mostly for internal use (such
as the assembly cache, dynamically generated code generation's cache...)
and it is not guranteed that your custom data put there won't be modified
by the internal operations of CLR runtime. IMO, you can consider put your
application's logic cache data in an application specific folder (such as a
sub directory under the App_Data dir of your ASP.NET application). How do
you think?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Hello Steven (& Peter)
Thanks for your input - yes I agree a sub-folder under App_Data is probably
the most appropriate location for a cached file in most cases.
But our "security infrastructure" product installs into existing web
services (which I did not implement or deploy), and the identity of the app
pool in which that web service is running will need write-permissions to the
folder where I cache my data. CodeGenDir is attractive because this must
already be the case.
Another concern is that system administrators might be wary for security
reasons of assigning write permissions to files/folders under the web
service application folder.
A possible solution is to use the last bit of the folder path from
CodeGenDir and store the files under my own tmpfiles folder
e.g. "C:\Program Files\my-company\my-product\Temporary Files"
This will simplify installation on servers where there are many web services
with our product installed - the app pool identities just need read/write
permissions to this folder.
Any comments?
Thanks for your reply Richlm,
Considered the further deployment and maintenance restriction you
mentioned, I think the program files specific path ( "C:\Program
Files\my-company\my-product\Temporary Files") would be preferred since it
is not a user specific path and won't be affected by another running
process or services.
HttpRuntime.CodeGenDir is still worth a try, however, if you want to put
temporary cached data file there, you need to always perform file existing
cache before you access it because directories and stuffs under that
location is not guranteed to persist all the time(maybe cleaned by other
services of the CLR or ASP.NET runtime).
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Richlm,
Any further progress on this or have you got the cache store implemented?
If there is anything else we can help, please feel free to let me know.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joe Fallon |
last post by:
I am trying to setup a cache that refreshes itself every hour. (My sample
code is for every minute so I can test it.)
I have found some examples that I thought worked but they all seem to fail....
|
by: Darrel |
last post by:
I thought this warranted a new thread.
Yesterday I asked about access relatively static content...is it better to
read from the DB, or just grab a text file. It was suggested that I use the
DB...
|
by: Jon |
last post by:
I have a couple of tables I want to load into a dataset and keep around
pretty much forever, although they will need to be refreshed every so often.
I can either put the dataset into an...
|
by: Bishop |
last post by:
I have googled to try and find an answer to this issue, but everything I
found
beats around the bush.
I have a web service that calls a DLL. In the DLL, I want to cache the small
table
data...
|
by: Bishop |
last post by:
I have googled to try and find an answer to this issue, but everything I
found
beats around the bush.
I have a web service that calls a DLL. In the DLL, I want to cache the small
table
data...
| |
by: Stan SR |
last post by:
Hi,
Some newbie questions.. :-)
First, what is the namespace to use for the Cache class ?
When I use this bit of code I get an error
if (Cache==null) Cache.Insert("myUserList",userlist);...
|
by: moondaddy |
last post by:
I had to repost this because I had to update and change my msdn alias. I
will re-ask the question and clarify a few things that were not clear
before.
This code is all executed on my dev...
|
by: Mathieu Cartoixa |
last post by:
Hi all,
We have developed a web application in ASP .NET (C#, .NET 2.0, IIS 6.0,
Windows Server 2003), with integrated Windows authentification, and
impersonation. I have tried to use memory...
|
by: BizWorld |
last post by:
I am trying to cache a full DROP Down that can have lot of values. so
i have 500 site users hitting a page in a second. i need to cache some
controls that does not change quite often during the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |