Я получаю следующую ошибку
Тип 'ServiceStack.Common.Web.EndPoint' определен в сборке, на которую нет ссылок.Необходимо добавить ссылку на сборку «ServiceStack.Common, версия = 3.9.70.0, Culture = нейтральный, PublicKeyToken = e33b67d3bb5581e4».
Я установил версию, указанную в ошибке, но все равно получаю сообщение об ошибке.Он также выдавал ошибку, связанную с подписанием сборки, но когда я пытался установить подписанную версию пакета слепков, это было несовместимо с моей версией .Net-кода.
public TescoDirectIdentityAuthorization getTescoDirectAuthToken (string clubcard, почтовый индекс строки, строковая фамилия) {Dictionary StoreAccessTokens = TescoDirectIdentityAuthorization.getInstance ();ICacheProvider cacheProvider = new RedisCacheProvider ();
clubcard = "634004027555269583";
postcode = "AL7 3EQ";
surname = "Order";
if (!cacheProvider.IsInCache(clubcard))
{
Dictionary<string, string> header = new Dictionary<string, string>();
IRestApiCommand command = new RestApiCommandFactory().GetApiCommand();
string proxyurl = SecurityFeatureHelper.GetJuvoConfigValue("CoApiProxy", "JuvoDeploymentConfig");
string IdentifyUrl = SecurityFeatureHelper.GetJuvoConfigValue("TescoDirectIdentityServiceUrl", "JuvoDeploymentConfig");
IdentityAuthorization IdentityAuthToken = IdentityAuthorization.getInstance();
try
{
//Set Header from this authorization token for second call
header = new Dictionary<string, string>();
try
{
IdentityAuthToken = getAuthToken();
if (IdentityAuthToken != null && !string.IsNullOrEmpty(IdentityAuthToken.AuthorizationToken))
{
string bearer = SecurityFeatureHelper.GetJuvoConfigValue("TescoDirectApiBearer", "JuvoDeploymentConfig");
if (!string.IsNullOrEmpty(bearer))
{
header.Add("Authorization", bearer + " " + IdentityAuthToken.AuthorizationToken);
}
else
{
header.Add("Authorization", IdentityAuthToken.AuthorizationToken);
}
}
}
catch (Exception ex)
{
LoggingHelper.LogErrorEvent(EventLogName.Tesco, EventSource.TescoCSA, "getTescoDirectAuthToken() method error while trying to fetch identity token:" + ex.Message);
throw ex;
}
//header.Add("Content-Type", "application/json");
//header.Add("Content-Type", "application/json; charset=utf-8");
TescoDirectIdentityTokenRequest req = new TescoDirectIdentityTokenRequest();
req.clubcard = clubcard;
req.postcode = postcode;
req.surname = surname;
Dictionary<string, string> postData = new Dictionary<string, string>()
{
{"", JavascriptUtility.Serialize(req)}
};
command = new RestApiCommandFactory().GetApiCommand();
callstart = DateTime.Now;
TescoDirectIdentityAPITokenResponse response = command.Execute<TescoDirectIdentityAPITokenResponse>(IdentifyUrl, null, postData, "POST", "application/json", "JSON", header, proxyurl);
callend = DateTime.Now;
bool val = LoggingHelper.GetTimeDiff(callstart, callend);
if (val)
{
LoggingHelper.LogInformationEvent(EventLogName.Tesco, EventSource.TescoCSA, "Logging for getTescoDirectAuthToken,time taken :" + (callend - callstart).TotalSeconds);
}
if (!String.IsNullOrEmpty(response.error))
{
Exception ex = new Exception("Error:" + response.error + " Description:" + response.description);
throw ex;
}
TescoDirectIdentityAuthorization TescoDirectIdentityAuthToken = new TescoDirectIdentityAuthorization();
//Set Values to Identitiy Authorize Token
TescoDirectIdentityAuthToken.AuthorizationToken = response.access_token;
TescoDirectIdentityAuthToken.CreatedTime = DateTime.Now;
TescoDirectIdentityAuthToken.ExpiryTime = IdentityAuthToken.CreatedTime.AddSeconds(response.expires_in - 120);
TescoDirectIdentityAuthToken.RefreshToken = response.refresh_token;
TescoDirectIdentityAuthToken.LastValidityChecked = DateTime.Now;
if (response.Claims != null & response.Claims.Length > 0)
{
foreach (IdentityDirectServiceClaims claim in response.Claims)
{
switch (claim.claimType.Substring(claim.claimType.LastIndexOf("/") + 1).ToLower().Trim())
{
case "userkey":
{
TescoDirectIdentityAuthToken.UserKey = claim.value;
break;
}
default:
break;
}
}
}
cacheProvider.Set<TescoDirectIdentityAuthorization>(clubcard, TescoDirectIdentityAuthToken, new TimeSpan(0, 0, response.expires_in - 120));
return TescoDirectIdentityAuthToken;
}
catch (Exception ex)
{
LoggingHelper.LogErrorEvent(EventLogName.Tesco, EventSource.TescoCSA, "Tesco Direct IdentityService:" + ex.Message);
throw ex;
}
}
else
{
return cacheProvider.Get<TescoDirectIdentityAuthorization>(clubcard);
}
}