WebSharp instructions (6)

zhaozj2021-02-16  45

Websharp application configuration

1, cache configuration

Websharp uses Microsoft's Cached Application Block to cache data, so the following cache information must be added in the application. For Cached Application Block, see Microsoft's related documents.

Use DataProtectionInfo to set the assembly and class which import

THE DATAPROTECTION INTERFCES for the cache.

->

ClassName = "Microsoft.ApplicationBlocks.cache.dataProtection.defaultDataProtection"

ValidationKey = "OCI44OQ9C3XADQ3 / BMHPKSPFZETEZLKXEN / AHQ8T7NVK / KMGAFNSSQJR00KUNHRSO MPLVWAINGEP6I14X9M A =="

Validation = "sha1" />

Use storageInfo to set the assembly and class which import

The Storage Interfaces for the cache.

Modes: Inproc, Outproc

->

! <- 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 "! / -> <- ->

MMFDictionarySize - It is the size (in) of the dictionary object (in mmfcachestorage) Used to store the references of cache it.

->

Use the scavengingalgorithm to set a class thing will be executed by

Scavenging ispeformed.

->

Use the expectioncheckinterval to change the interval to check for

Cache items eviration. The value attribute is represented in seconds.

->

2, system persistence configuration information

Configure PersistenceProperty, for web application, you can configure it in Global.asax, for Windows applications, you can set when program initialization.

The following is an example of setting:

PersistenceProperty PP = New PersistenceProperty ();

Pp.connectionstring = "server = 127.0.0.1; uid = sa; pwd =; database = logisticsdeemo;"; // database connection string

Pp.DatabaseType = DatabaseType.mssqlserver; // Database Type

Pp.mapFileLocation = @ "Websharptestlib, WebsharptestLib.xml"; // XML definition file path

Pp.mapFileLocationTye = MapFileLocationType.assembly; // XML file path Type

PP.USERID = "sa"; // Database User Name, must be consistent with the username in the database connection string

pp.password = ""; // Database User Password, must be consistent with the user password in the database connection string

ApplicationConfiguration.defaultPersistenceProperty = PP; // Set the default configuration properties of the application

The description of the configuration information is as follows:

1) The database connection string, the username and password settings are set according to regular settings.

2) MapFileLocationTye specifies that the path type of the XML mapping file can have three types:

a) ABSOLUTEPATH: Using absolute path form, in which case MapFileLocation is set to the absolute path, such as "D: / AppPath / XML".

b) VirtualPath: For web applications, you can set it to the form of virtual paths, such as "/ myWebApp / EntityDefinitions /".

c) Assembly: XML file is compiled as a resource file. With this form, you need to set the build operation attribute of the XML file to "embedded resources". In this case, the MapFileLocation format is: "AssemblyName, Namespace". For example, the XML file is located below the XML folder of the Websharptestlib project, and MapFileLocation can be set to: "Websharptestlib, Websharptestlib.xml"

转载请注明原文地址:https://www.9cbs.com/read-26558.html

New Post(0)