使用 NCache 使用 Microsoft Azure 安装脚本

Web 角色专为快速配置和取消配置您的云应用程序而设计。 你可以有 NCache 随 Web 角色的部署自动安装。 为此,您需要下载 NCache NuGet软件包 其中包含部署 Web 角色期间将需要的所有安装脚本。 请 点击此处 有关如何下载的更多信息 NCache NuGet 包。


NCache Azure 安装脚本

对于安装 NCache 在 Azure 中,在部署 Web 角色期间,运行的第一个脚本是 启动任务.cmd 依次调用其他脚本,执行以下任务:

  • Install 安装 NCache
  • 添加客户端节点
  • 如果已配置,则创建客户端缓存
  • 检查客户端缓存是 InProc 还是 OutProc。 如果是OutProc,则启动它

这些脚本中使用了一些必须首先定义的启动环境变量。 为此,应在 服务定义.csdef 您的 Web 角色的文件。

<Startup>
 <Task commandLine="Azure_Install_Scripts\startuptask.cmd" 
       executionContext="elevated" 
       taskType="simple">
  <Environment>

   <!--Check whether Azure project is running in emulated environment or not. 
   If this role is running in emulated environment, then startup scripts will
   be avoided-->
   <Variable name="EMULATED">
    <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
   </Variable>

   <!--Specify path for NCache Azure Client Setup for installation on 
   client role--> 
   <Variable name="NCache.SetupPath" 
             value="" />

   <!--Specify cache name to add current role as client node of specified 
   cluster cache-->
   <Variable name="NCache.CacheName" 
             value="test" />

   <!--Specify cache server IP for communication with cache. 
   For multiple servers, specify comma separated IPs as specified in example.
   For public port, specify ports with server as "10.0.0.4:8270,10.0.0.5:8271"-->
   <Variable name="NCache.CacheServers" 
             value="23.97.66.31:8250,23.97.66.31:8251" />

   <!--Specify "true" if you want to create a client cache on this role 
   otherwise "false"-->
   <Variable name="NCache.CreateClientCache" 
             value="true" />

   <!--Specify client cache name if you want to configure client cache on 
   this role-->
   <Variable name="NCache.ClientCacheName" 
             value="myclientcache" />

   <!--Specify client cache size. (Compulsory option for configuring 
   client cache)-->
   <Variable name="NCache.ClientCacheSize" 
             value="250" />

   <!--Specify "true" if your client role is outside the virtual network of 
   your cache. Your public endpoints will be used for communication with the 
   server from current client role. If your client role is within the same virtual
   network as your cache, then specify "false"-->
   <Variable name="NCache.UseEndPoint" 
             value="true" />

   <!--Specify startup task log path-->
   <Variable name="NCache.LogPath" 
             value="" />

   <!-- Specify if client cache is inproc or not-->
   <Variable name="NCache.IsInproc" 
             value="false" />
  </Environment>
 </Task>
</Startup>

请参阅自述文件

A readme.txt文件 文件随 NuGet 包一起提供,它解释了 web.config 的更改 NCache 在 Azure 会话存储提供程序中,以及 NCache 在 Azure client.ncconf 中更改以连接到环境中已配置的缓存。 此信息可作为参考 NCache 在 Azure 配置中需要更改。

接下来做什么?

联系我们

联系电话
©版权所有 Alachisoft 2002 - 版权所有。 NCache 是 Diyatech Corp. 的注册商标。