'세션'에 해당되는 글 2건

  1. 2007.06.08 Out-of process session을 사용해야 하는 이유
  2. 2007.05.22 ASP.NET SessionState Server
posted by 써니루루 2007. 6. 8. 13:08
원문 : http://www.microsoft.com/korea/msdn/library/windows/issues/2003/ws03perfbench/default.aspx

기존 ASP에서의 Session은 In-Process의 세션만을 사용하였고 이 때문에 개별적인 세션을 사용하기 힘들었습니다.
ASP.NET에서는 Out of process session인 'ASPState'로 서비스에 등록되어 있는 State server를 이용하여 세션을 관리해야하는 이유가 이것 때문입니다.
아래는 위 원문에서 발췌한 내용입니다.


클러스터에서 세션 개체를 사용할 수 있는 기능. 장바구니는 클러스터에서 사용 가능해야 하므로 세션 개체를 사용하여 ASP에서 장바구니를 구현할 수 없습니다. ASP를 사용하면 세션 개체는 웹 서버와 함께 항상 in-process이며 여러 웹 서버는 사용자를 해당 고유한 장바구니에 다시 매핑할 수 없습니다. 클라이언트 선호도를 사용할 수 있지만 서버가 다운되거나 클러스터에 추가될 때 장애 조치 상태가 여전히 작동하지 않을 것이며 일부 사용자 세션 상태는 손실될 것입니다. 하지만 ASP.NET을 사용하면 이러한 제한은 더 이상 적용되지 않습니다. in-process에서 중앙 전용 상태 서버로 또는 중앙 RDBMS 데이터베이스로 세션 개체를 쉽게 매핑할 수 있습니다. 따라서 ASP.NET 버전은 세션 개체를 사용하여 각 사용자에 대한 장바구니를 저장합니다. 장바구니는 네트워크를 통해 전달하거나 데이터베이스에 기록할 수 있도록 serializable로 표시됩니다. 클러스터에 사용할 수 있으려면 ASP 버전이 사용자 지정 데이터베이스 처리 루틴에서 장바구니를 구현해야 합니다.
posted by 써니루루 2007. 5. 22. 17:04

Out-of-process Mode

Included with the .NET SDK is a Windows® NT service: ASPState. This Windows service is what ASP.NET uses for out-of-process session state management. To use this state manager, you first need to start the service. To start the service, open a command prompt and type:

net start aspstate

What you'll see is:

Figure 1. Starting the Windows NT service ASPState at the command prompt

At this point, the Windows NT Service ASPState has started and is available to ASP.NET. Next, we need to configure ASP.NET to take advantage of this service. To do this we need to configure config.web:

<configuration>
  <sessionstate 
      mode="stateserver"
      cookieless="false" 
      timeout="20" 
      sqlconnectionstring="data source=127.0.0.1;user id=<user id>;password=<password>"
      server="127.0.0.1" 
      port="42424" 
  />
</configuration>

We changed only from inproc mode to stateserver mode. This setting tells ASP.NET to look for the ASP state service on the server specified in the server and port settings—in this case, the local server.

We can now call SessionState.aspx, set a session state value, stop and start the IIS process (iisreset), and continue to have access to the values for our current state.