开发者

Communicating between ASP.NET applications on the same machine

I have a situation where information about a user is stored in the web application cache and when that information is updated in one application - I want to notify the other applications (running on the same machine) that the data should be removed from it's cache so it can be refreshed. Basically I need to keep cached data in sync across multiple asp.net applications.

I have started down the path of using a central web service to help coordinate the notifcations but it is turning out to be more complex than I think it needs to be.

Is there a way that one asp.net application can easily reach across to another on the same box to clear an item from the cache?

Is there a better way to achieve shared cached information than using the application cache?

I really want to create a way for apps to communicate in a loosely coupled way - I looked at nservice bus but the dependency on MSMQ scared me 开发者_高级运维away - my client has had bad experiences with MSMQ and does not want to support an app that requires it.

Suggestions? Michael


I agree with Hogan. Best is to use a shared database. I want to add to that that, when using SQL Server, you can use SQL Cache Dependency. This SQL Server mechanism allows notifications to applications in such a way that used caches can be invalided directly after a change is made to the data.


A shared database is probably going to cause you the least pain.

Edit

Note: ASP.NET allows you to make "cache clearing" triggers on SQL server changes. Should be a quick search in the cache examples on MSDN to find some examples. Thus when the user info stored in the cache changes in the DB the local cache copy will clear and be re-loaded from the DB.


There are commercial distributed caches available for .net other than Microsoft Velocity - NCache, Coherence, etc.


How about Velocity? It's a distributed cache that works between servers as well as between applications. It has PowerShell management and all sorts of documentation to get you going faster and be far more maintainable in the long-term.


What about COM/DCOM, using namespace System.Runtime.Remoting

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜