Windows Server AppFabric - Velocity 시작하기
Enterprise Architecture/Architecture 2010. 1. 28. 09:00 |
혹시 위의 CMD 에서 키보드를 잘못 누른경우 아래의 인터넷 옵션의 인증서 창에서 신뢰되지 않은 게시자를 지우기 바랍니다.
캐시 서버 시작
콘솔 프로젝트에 참조 추가
CTP2 에서 System.Data.Caching 이 Microsoft.Data.Caching 으로 네임스페이스가 변경되었습니다.
NamedCache 를 만듭니다.
New-Cache -CacheName NamedCache1 -Secondaries 1 -TTL 15
App.Config 의 설정입니다.
App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!--configSections must be the FIRST element -->
<configSections>
<!-- required to read the <dataCacheClient> element -->
<section name="dataCacheClient"
type="Microsoft.Data.Caching.DataCacheClientSection,
CacheBaseLibrary"
allowLocation="true"
allowDefinition="Everywhere"/>
<!-- required to read the <fabric> element, when present -->
<section name="fabric"
type="System.Data.Fabric.Common.ConfigFile,
FabricCommon"
allowLocation="true"
allowDefinition="Everywhere"/>
</configSections>
<!-- simple client -->
<dataCacheClient deployment="simple">
<!-- (optional) specify local cache
<localCache
isEnabled="true"
sync="TTLBased"
objectCount="100000"
ttlValue="300" />
-->
<!-- note: cache notifications are
not supported with simple client -->
<!-- cache host(s) -->
<hosts>
<host
name="DPOWERUMC"
cachePort="22233"
cacheHostName="DistributedCacheService"/>
</hosts>
</dataCacheClient>
</configuration>
아래는 간단한 샘플 소스 코드입니다.
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Data.Caching;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//declare array for cache host(s)
DataCacheServerEndpoint[] servers = new DataCacheServerEndpoint[1];
//specify cache host(s)
servers[0] = new DataCacheServerEndpoint("DPOWERUMC",
22233, "DistributedCacheService");
//specify cache client configuration
DataCacheFactory mycacheFactory
= new DataCacheFactory(servers, true, true);
//get cache client for cache "NamedCache1"
DataCache myDefaultCache = mycacheFactory.GetCache("NamedCache1");
}
}
}
아래는 캐시 서버를 중지하는 방법입니다.
그리고 ShareFolder 로 설치하면 Compact 3.5 Database 인 .SDF 파일이 생깁니다. 캐시 서버가 동작할 경우 파일 공유가 불가능하여 데이터베이스의 내용을 볼 수 없습니다. 필자의 견해로는 Compact DB 가 아닌 SQL Server Database 로 설치할 것을 권장합니다.
설치를 수정하려면 C:\Program Files\Microsoft Distributed Cache\V1.0\Uninstall-128913592820152769.exe 를 실행하시면 됩니다. 단, 프로그램 추가/제거에서 찾을 수 없답니다. ^^
'Enterprise Architecture > Architecture' 카테고리의 다른 글
개발자도 알아야 할 응용 프로그램 모델링 2/7 - 왜 모델링인가? (2) | 2012.08.02 |
---|---|
개발자도 알아야 할 응용 프로그램 모델링 1/7 - 들어가기에 앞서... (0) | 2012.08.02 |
Windows Server AppFabric - 호스트 추가하기 (0) | 2010.01.28 |
Windows Server AppFabric - Velocity 시작하기 (0) | 2010.01.28 |
Windows Server AppFabric - Velocity 란? (0) | 2010.01.27 |
거버먼트 2.0 - 개방, 공유, 활용 (2) | 2010.01.21 |
댓글을 달아 주세요