fixes U4-5492 Distributed calls won't work if IIS sites between servers have the same HttpRuntime.AppDomainAppId

This commit is contained in:
Shannon
2014-10-03 09:44:03 +10:00
parent cce63d6eaa
commit 0d74642e56
2 changed files with 8 additions and 5 deletions

View File

@@ -7,10 +7,10 @@ namespace Umbraco.Tests.Cache
public class CacheRefresherTests
{
[TestCase("", "123456", "testmachine", true)] //empty hash will continue
[TestCase("2c8aabac795d189d444a9cdc6e2a1819", "123456", "testmachine", false)] //match, don't continue
[TestCase("2c8aabac795d189d444a9cdc6e2a1819", "12345", "testmachine", true)]
[TestCase("2c8aabac795d189d444a9cdc6e2a1819", "123456", "testmachin", true)]
[TestCase("2c8aabac795d189d444a9cdc6e2a181", "123456", "testmachine", true)]
[TestCase("fffffff28449cf33", "123456", "testmachine", false)] //match, don't continue
[TestCase("fffffff28449cf33", "12345", "testmachine", true)]
[TestCase("fffffff28449cf33", "123456", "testmachin", true)]
[TestCase("fffffff28449cf3", "123456", "testmachine", true)]
public void Continue_Refreshing_For_Request(string hash, string appDomainAppId, string machineName, bool expected)
{
var refresher = new CacheRefresher();

View File

@@ -39,7 +39,10 @@ namespace umbraco.presentation.webservices
// that executed the request.
if (hash.IsNullOrWhiteSpace() == false && SystemUtilities.GetCurrentTrustLevel() == AspNetHostingPermissionLevel.Unrestricted)
{
var hashedAppId = (machineName + appDomainAppId).ToMd5();
var hasher = new HashCodeCombiner();
hasher.AddCaseInsensitiveString(machineName);
hasher.AddCaseInsensitiveString(appDomainAppId);
var hashedAppId = hasher.GetCombinedHashCode();
//we can only check this in full trust. if it's in medium trust we'll just end up with
// the server refreshing it's cache twice.