0

我有一个自定义的 Sharepoint 2010 Web 部件,它通过注册过程中的一系列步骤运行用户。在每一步,当任何需要的输入完成时,用户单击继续按钮,这是一个标准的服务器端按钮控件。后面的代码在调用 Response.Redirect 之前会进行一些验证和数据库更新,后者会使用更新的会话数据刷新同一页面。

(注意:会话数据作为加密查询字符串参数保存在 URL 中,而不是由常规的 Session 对象保存)

此解决方案在我的单服务器测试环境中运行良好,但是一旦我将其部署到负载平衡阶段或生产环境,一些请求就会在单击继续 (ERR_TIMED_OUT) 后简单地超时而没有收到响应。

  1. Webpart 日志显示 Webpart 实际上是使用有效 URL 调用 Response.Redirect
  2. 这不是服务器资源问题。超时可以设置为一分钟或更长时间,没有收到响应。
  3. 仅在部署到负载平衡服务器时发生
  4. 当我在其中一台负载平衡服务器上完成注册时,一切正常- 这让我相信负载平衡和服务器会话存在问题。我知道,当从 NLB 中的一个服务器节点与负载平衡的 Web 应用程序交互时,所有请求都将转到该特定服务器。

我知道我以前也遇到过类似的问题,但那是几年前的事了,我不记得解决方案是什么了。

        try
        {
            // get clean URL without query string parameters
            string url;
            if (string.IsNullOrEmpty(Request.Url.Query))
                url = Request.Url.AbsoluteUri;
            else
                url = Request.Url.AbsoluteUri.Replace(Request.Url.Query, "");

            // add encrypted serialized session object
            url += "?" + Constants.QueryStringParameterData + "=" + SessionData.Serialize(true);

            _log.Info("Redirecting to url '" + url + "'..");
            Response.Redirect(url);
        }
        catch (Exception) { }
4

2 回答 2

1

OK, the problem has been resolved.

It turned out to be UAG that was doing something in the background, and the way I discovered it was that the links that triggered the postbacks got changed from

http://some_url.com/sites/work/al2343/page.aspx

to

http://some_other_url.domain.com/uniquesigfed6a45cdc95e5fa9aa451d1a37451068d36e625ec2be5d4bc00f965ebc6a721/uniquesig1/sites/work/al2343/page.aspx

(Take note of the "uniquesig" in there)

This was the URL the browser actually tried to redirect to, but because of whatever the issue was with UAG the navigation froze.

I don't know how they fixed it, but at least the problem was not in my component.

于 2012-06-21T21:14:08.500 回答
0

One possibility that Request.Url is how particular server sees the url (something like http://internalServer44/myUrl) instead of externally visible load-balanced Ulr (like http://NlbFarmUrl/myUrl).

In case of SharePoint it will be better to use SPContext.Current.Site/Web properties to get base portion of Url since this Urls should already be in externally visible form.

于 2012-06-20T02:30:27.580 回答