As funções da Web são projetadas para o rápido provisionamento e desprovisionamento de seus aplicativos em nuvem. Você pode ter NCache instalado automaticamente com a implantação de uma função Web. Para isso, você precisa baixar o NCache Pacote NuGet que contém todos os scripts de instalação que serão necessários durante a implantação da Web Role. Por favor clique aqui para obter mais informações sobre como fazer o download do NCache Pacote NuGet.
Para a instalação de NCache no Azure durante a implantação da Web Role, o primeiro script executado é startuptask.cmd que por sua vez chama outros scripts, realizando as seguintes tarefas:
Existem algumas variáveis de ambiente de inicialização usadas nesses scripts que devem ser definidas primeiro. Para isso, o seguinte código deve ser inserido no Definição de serviço.csdef arquivo de sua função 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 é fornecido com o pacote NuGet que explica as alterações do web.config para o NCache no provedor de armazenamento de sessão do Azure e NCache em alterações de client.ncconf do Azure para conectar-se a um cache já configurado em seu ambiente. Esta informação pode ser usada como referência para quando NCache nas configurações do Azure precisam ser alteradas.