0

我有一个由第三方应用程序使用的 Web API2 应用程序。当应用程序到达我的端点时,我的应用程序会发送 oAuth 凭据进行身份验证并从第三方应用程序获取结果。

最近一些事务失败了,当我添加一些日志时,我看到错误:远程服务器返回错误:(410)所有失败的事务都发生了。不幸的是,当我调用我的应用程序时,我无法重现此问题。以下是我正在使用的代码。导致此错误的问题可能是什么?

 public async Task<customerModel>  SendSigned(string url)
{
    customerModel customermodel = null;
    try
    {
        OAuthBase oauthBase = new OAuthBase();

        string oAuthKey = ConfigurationManager.AppSettings["oAuthKey"];
        string oAuthSecret = ConfigurationManager.AppSettings["oAuthSecret"];
        string timestamp = oauthBase.GenerateTimeStamp();
        string nonce = oauthBase.GenerateNonce();
        string normalizedUrl;
        string normalizedRequestParameters;
        string sig = HttpUtility.UrlEncode(oauthBase.GenerateSignature(
            new Uri(url), oAuthKey, oAuthSecret, string.Empty, string.Empty,
            "GET", timestamp, nonce, out normalizedUrl, out normalizedRequestParameters));
        string requestUrl = String.Format("{0}?{1}&oauth_signature={2}", normalizedUrl, normalizedRequestParameters, sig);

        HttpWebRequest request = null;
        request = (HttpWebRequest)HttpWebRequest.Create(requestUrl);
        using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
        {
           myXMLDocument = new XmlDocument();
           customermodel = GetCustomerInformation(response);
        }

        return await Task.Run(() => customermodel);
    }
    catch (Exception ex)
    {
       _logger.Error("Error in SendSigned method", ex.InnerException);
        return customermodel;
    }
}
4

1 回答 1

0

的解释410目标资源在源服务器上不再可用,并且基于 链接这种情况很可能是永久的(类似于404)

我建议你考虑一下你最近对你的

  1. API 签名
  2. 资产/资源的文件夹重组/重组
  3. 路由更改
  4. 资源重命名
于 2017-06-29T15:33:00.380 回答