Reputation: 123
I have done something, but I don't know what I need to do next.
I deploy the same site in server A and B, which has the same domain (http://dev.**.com
).
They have the same machinekey
, which I declared in the web.config
in the site.
The session state has pointed to the same ASPState
database.
As you can see from the following screenshot, the two sites has respective appId
and AppName
. That means the two sites cannot share session.
Could anybody tell me what I need to do next? any help will be appreciated.
Do I need to declare the application name? But where I should to declare it?
Upvotes: 2
Views: 1296
Reputation: 2919
I'd like to propose an even simpler solution, though I guess I'm a little late to dinner. :)
The IIS 7 Metabase Path of course is the AppName you're seeing, and the AppId is hashed from it. If two IISes are intended to share session, and their AppNames (Metabase Paths) are different, you won't be able to share sessions. There are a bunch of recommendations out there to modify the stored procedure that generates the name, but this seems like a terrible hack to me. While I like the Code Project's solution of keeping out of the stored procedures, there's an even easier way!
Go into IIS 7 Manager on each web server. Select the Web Site you want to share state across IISes. Click Advanced Settings off to the right. Enter a unique value for ID, and use the same value on each IIS. Restart each Web Site and Bob's your uncle.
Upvotes: 1
Reputation: 10433
Change your [TempGetAppID] stored procedure.
example SET @appName = LOWER(@appName) -> SET @appName = LOWER(APP_NAME())
APP_NAME() return connectioned application name. "Application Name=YourAppName;" set to connectionString value.
Hope this help!
Upvotes: 0