All articles

Site id load balancing környezetben

Published 2014-04-16 - Last modified 2014-04-16

Original: https://soci.hu/blog/index.php/2014/04/16/site-id-load-balancing-kornyezetben/

Az közismert, hogy ha több ASP.NET-et kiszolgáló IIS van load balancer mögött, akkor a machineKey-eket egyformára kell venni a machine.configban, illetve külső, osztott session state tárolót kell használni:

<configuration>
  <system.web>
    <machineKey validationKey="ugyanaz az érték minden szerverre" decryptionKey="ugyanaz az érték minden szerverre" validation="SHA256" decryption="AES" />
    <sessionState mode="SQLServer" stateNetworkTimeout="30" stateConnectionString="..." allowCustomSqlDatabase="true" sqlConnectionString="..." cookieless="false" timeout="1441" />
  </system.web>
</configuration>

Azonban ez nem elég, és a következő dolog nincs agyondokumentálva. Minden egyes sitenak azonosnak kell lenni az id-jának:

AppId

“In short: under Advanced Settings of each site in IIS, there’s a numeric ID which is configurable but apparently auto-incremented from 1 in order of site creation on that server. These IDs are used in the ASPStateTempApplications table, and were different between our servers, resulting in different Session IDs.”

Itt írnak róla, meg itt.