日期:2013-07-13  浏览次数:20376 次

Websharp应用系统的配置

1、 缓存的配置

Websharp使用了微软的Cached Application Block来缓存数据,因此,下面的缓存信息必须在应用程序中添加。关于Cached Application Block,可以参见微软的相关文档。

<configuration>

<configSections>

<section name="CacheManagerSettings" type="Microsoft.ApplicationBlocks.Cache.CacheConfigurationHandler,Microsoft.ApplicationBlocks.Cache" />

<section name="WebsharpExpirationPolicy" type="Websharp.Service.WebsharpCofigurationHandler,Websharp" />

</configSections>

<CacheManagerSettings>

<!-- DATA PROTECTION SETTINGS

Use DataProtectionInfo to set the assembly and class which implement

the dataprotection interfaces for the cache.

-->

<DataProtectionInfo AssemblyName="Microsoft.ApplicationBlocks.Cache"

ClassName="Microsoft.ApplicationBlocks.Cache.DataProtection.DefaultDataProtection"

ValidationKey="Oci44OQ9C3xAdQ3/BMHpksPfzeTezLkXen/ahQ8T7nVk/KMgAFnssQJr00KUNhRso+MpLVwAinGep6i14X9M+A=="

Validation="SHA1"/>



<!-- STORAGE SETTINGS

Use StorageInfo to set the assembly and class which implement

the storage interfaces for the cache.



Modes: InProc, OutProc

-->

<StorageInfo AssemblyName="Microsoft.ApplicationBlocks.Cache" ClassName="Microsoft.ApplicationBlocks.Cache.Storages.SingletonCacheStorage" Mode="InProc" Validated="true" Encrypted="true" RemotingUrl="tcp://localhost:8282/CacheService" />

<!--StorageInfo AssemblyName="Microsoft.ApplicationBlocks.Cache" ClassName="Microsoft.ApplicationBlocks.Cache.Storages.SqlServerCacheStorage" Mode="InProc" ConnectionString="user id=sa;password=msljkdv1;Network=DBMSSOCN;DATABASE=cacheab;SERVER=msljksrv02" Encrypted="true" Validated="true" ApplicationName="Sports" RemotingUrl="tcp://localhost:8282/CacheService" /-->

<!--<StorageInfo AssemblyName="Microsoft.ApplicationBlocks.Cache" ClassName="Microsoft.ApplicationBlocks.Cache.Storages.MmfCacheStorage" Mode="InProc" BasePath="c:\mmfcache\" Encrypted="true" Validated="true" MmfDictionarySize="1048576" RemotingUrl="tcp://localhost:8282/CacheService"/>-->



<!--

MmfDictionarySize - It is the size (in bytes) of the dictionary object (in MmfCacheStorage) used to store the references of cache items.

-->



<!-- SCAVENGING SETTINGS

Use the ScavengingAlgorithm to set a class that will be executed when

scavenging is performed.

-->



<ScavengingInfo AssemblyName="Microsoft.ApplicationBlocks.Cache" ClassName="Microsoft.ApplicationBlocks.Cache.Scavenging.LruScavenging" MemoryPollingPeriod="60" UtilizationForScavenging="80" MaximumSize="5"/>

<!-- EXPIRATION SETTINGS

Use the ExpirationCheckInterval to change the interval to check for

cache items expiration. The value attribute is represented in seconds.

-->

<ExpirationInfo Interval="1" />

</CacheManagerSettings>