[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

Problem creating cache dependencies (reposted

daniel

9/13/2006 4:49:00 AM

Hi,

I experiencing problems when i create cache dependencies for objects I wish
to add to my web cache. Essentially I have a network directory with a number
of subdirectories. My application creates objects which represents the data
held in these subdirectories. I am creating a CacheDependency for each
object over the objects subdirectory. After i create a certain number of
dependencies (seems in my case to be 48) I get an AccessViolationExcepton -
Attempted to read or write protected memory, a partial stack trace of the
exception is at the end of this post. When i copy the entire netork
directory contents to my local machine I can create the Cache dependencies
with no problems.

I am creating a cache dependency for each subdirectory because reading and
interpreting the data contained in the subdirectory is a costly operation.

I have tried creating a newtork drive map as well as using the UNC path.

I have tried using a vairety of operating systems, (Windows xp, Windows
2000, Windows 2003) for the network share, all with the same results.

at System.Web.UnsafeNativeMethods.RaiseFileMonitoringEventlogEvent(String
eventInfo, String path, String appVirtualPath, Int32 hr)
at System.Web.FileChangesMonitor.CreateFileMonitoringException(Int32 hr,
String path)
at System.Web.DirMonCompletion..ctor(DirectoryMonitor dirMon, String dir,
Boolean watchSubtree, UInt32 notifyFilter)
at System.Web.DirectoryMonitor.StartMonitoring()
at System.Web.DirectoryMonitor.StartMonitoringFile(String file,
FileChangeEventHandler callback, String alias)
at System.Web.FileChangesMonitor.StartMonitoringPath(String alias,
FileChangeEventHandler callback, FileAttributesData& fad)
at System.Web.Caching.CacheDependency.Init(Boolean isPublic, String[]
filenamesArg, String[] cachekeysArg, CacheDependency dependency, DateTime
utcStart)
at System.Web.Caching.CacheDependency..ctor(String filename, DateTime
start)
at System.Web.Caching.CacheDependency..ctor(String filename)


Regards,
Daniel

--
Daniel
9 Answers

lukezhan

9/13/2006 7:16:00 AM

0

Hello Daniel,

When we add CacheDependency on file system like an local folder or network
shared folder, ASP.NET will add file system watcher htread to monitor the
changes in such folders. You may also see it in the call stack. For the AV
exeception, it seems that some limitation are reached for your ASP.NET
application, for example, max connections between the web server and file
server, or threads the ASP.NET application can uitlize.

I saw a community member has provide a suggestion about creating only one
FileSystemWatcher on "\\itchy\imagelink\Books\V3Books" and set the
IncludeSubdirectories property. Can this help on your solution?

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/de....
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.



daniel

9/13/2006 9:25:00 PM

0

Hi Luke,

Unfortunatly i am not able to simple watch the whole directory and
subdirectories, i have found that this caused more problems in my system, I
have found that windows on occasion reports a directory changed that didn't
actually change.

Is there a way to configure my application so i can change the number of
cache dependencies that is allowed for a directory location?
--
Daniel


"Luke Zhang [MSFT]" wrote:

> Hello Daniel,
>
> When we add CacheDependency on file system like an local folder or network
> shared folder, ASP.NET will add file system watcher htread to monitor the
> changes in such folders. You may also see it in the call stack. For the AV
> exeception, it seems that some limitation are reached for your ASP.NET
> application, for example, max connections between the web server and file
> server, or threads the ASP.NET application can uitlize.
>
> I saw a community member has provide a suggestion about creating only one
> FileSystemWatcher on "\\itchy\imagelink\Books\V3Books" and set the
> IncludeSubdirectories property. Can this help on your solution?
>
> Sincerely,
>
> Luke Zhang
>
> Microsoft Online Community Support
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/de....
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>

lukezhan

9/14/2006 5:44:00 AM

0

I think the the number of cache dependencies is not fixed since it depends
on the current resource on the server. And you also have seen the number is
different on different server.

Is it possible for following solution: copy all folders from the remote
server to your web server, and build a real time replication on them. Once
a file is changed on the remote server, the file on web server is also
changed. And you ASP.NET application can set cache dependency on local
files and folders.

Sincerely,

Luke Zhang

Microsoft Online Community Support

This posting is provided "AS IS" with no warranties, and confers no rights.



daniel

9/14/2006 6:31:00 AM

0

Hi Luke,

Unfortunatly replicating the file system on the webserver is not feasible...
The amout of data to be replicated could potentially be quite large with some
customers ( sometimes several gigabytes of data), I also have a user
requirement that the data should not have to be stored on the webserver for
security reasons.

Also, in seperate testing i have tried creating an individual file watcher
on every file in every directory on the network share and was able to do this
flawleslly. I am wondering if it is actually a file system watcher that is
actually the problem or something else in the Cache dependency.

Regards,
--
Daniel


"Luke Zhang [MSFT]" wrote:

> I think the the number of cache dependencies is not fixed since it depends
> on the current resource on the server. And you also have seen the number is
> different on different server.
>
> Is it possible for following solution: copy all folders from the remote
> server to your web server, and build a real time replication on them. Once
> a file is changed on the remote server, the file on web server is also
> changed. And you ASP.NET application can set cache dependency on local
> files and folders.
>
> Sincerely,
>
> Luke Zhang
>
> Microsoft Online Community Support
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>

lukezhan

9/15/2006 8:46:00 AM

0

Hello,

Would you please provide more detials on how you implement the Cache
Dependency on shared folders ( A sample project will be more appreciated).
I will perform more research on my side to see if this can be improved in
some way.

If you want to send me by email, you can get may actual email by remove
"online"

Sincerely,

Luke Zhang

Microsoft Online Community Support
This posting is provided "AS IS" with no warranties, and confers no rights.



lukezhan

9/19/2006 9:40:00 AM

0

Hello,

Just checked if you have sent me the file as I request. I have not recieved
it so far. Or you have any other questions, please feel free to let us know.

Sincerely,

Luke Zhang

Microsoft Online Community Support
This posting is provided "AS IS" with no warranties, and confers no rights.



daniel

9/20/2006 1:24:00 AM

0

Hi Luke,

Sorry about the delay in replying, I have sent an email with the sample
application as requested.

--
Daniel


"Luke Zhang [MSFT]" wrote:

> Hello,
>
> Would you please provide more detials on how you implement the Cache
> Dependency on shared folders ( A sample project will be more appreciated).
> I will perform more research on my side to see if this can be improved in
> some way.
>
> If you want to send me by email, you can get may actual email by remove
> "online"
>
> Sincerely,
>
> Luke Zhang
>
> Microsoft Online Community Support
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>

lukezhan

9/20/2006 7:39:00 AM

0

Hello Daniel,

I have got your mail and performed more research on my side. I will keep
you posted once I got any progress.

Thanks,

Luke Zhang

Microsoft Online Community Support
This posting is provided "AS IS" with no warranties, and confers no rights.



lukezhan

9/21/2006 6:14:00 AM

0

Hello Daniel,

I found a related article which talking about the conncetion number
limitation between server and client:

http://support.microsoft.com/...

The default value in it is 50, and this is very close to the number (48)
you found. This make me think the limitation may be here. you may change
the value of MaxCmds (client) and MaxMpxCt (server) to 500 and test the
application again. (A reboot may be required here). Can this help on the
issue?

Sincerely,

Luke Zhang

Microsoft Online Community Support
This posting is provided "AS IS" with no warranties, and confers no rights.