创建网站集时超时

发布于 2024-10-08 22:15:35 字数 1289 浏览 0 评论 0原文

我正在尝试以编程方式创建网站集。 它已经工作了大约 6 个月,但是在服务器更新(各种补丁)之后,它不再工作了(我们有 3 台服务器:1 台开发、1 台测试、1 台生产)。它仍然可以在我的尚未更新的开发环境中运行,但不能在其他两个环境中运行。 我没有收到任何错误消息,它只是挂在应该添加网站集的代码处(请参阅下面的代码)。 我使用的是 Windows Server 2003 R2 和 Sharepoint 2007(版本 12.0.0.6421 )。 它不会给我任何错误,它只是挂起,直到 Internet Explorer 出现“请求超时”响应。 如果我尝试调试代码,代码就会停在那里,什么也不会发生。没有错误消息或任何东西。

    public static string CreateSPAccountSite(string siteName)
    {
        string url = "";
        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            SPWeb web = SPContext.Current.Web;
            using (SPSite siteCollectionOuter = new SPSite(web.Site.ID))
            {
                SPWebApplication webApp = siteCollectionOuter.WebApplication;
                SPSiteCollection siteCollection = webApp.Sites;

                SPSite site = siteCollection.Add("sites/" + siteName, siteName, "Auto generated Site collection.", 1033, "STS#0", siteCollectionOuter.Owner.LoginName, siteCollectionOuter.Owner.Name, siteCollectionOuter.Owner.Email); //Hangs here                    site.PortalName = "Portal";
                site.PortalUrl = mainUrl; // https://www.ourdomain.net
                url = site.Url;
            }
        });

        return url; //Should be "https://www.outdomain.net/sites/siteName"

    }

I am trying to create a site collection programmatically.
It has worked for about 6 months, but after the servers have been updated (various patches) it doesn’t work anymore (we have 3 servers: 1 development, 1 test, 1 production). It is still working in my development environment which hasn’t been updated, but not on the two others.
I don’t receive any error messages, it just hangs at the code that is supposed to add the site collection (see code below).
I am using Windows Server 2003 R2 and Sharepoint 2007 (version 12.0.0.6421 ).
It doesn’t give me any errors, it just hangs until Internet Explorer comes with a “request timed out” response.
If I try and debug the code, the code just stops there and nothing happens. No error messages or anything.

    public static string CreateSPAccountSite(string siteName)
    {
        string url = "";
        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            SPWeb web = SPContext.Current.Web;
            using (SPSite siteCollectionOuter = new SPSite(web.Site.ID))
            {
                SPWebApplication webApp = siteCollectionOuter.WebApplication;
                SPSiteCollection siteCollection = webApp.Sites;

                SPSite site = siteCollection.Add("sites/" + siteName, siteName, "Auto generated Site collection.", 1033, "STS#0", siteCollectionOuter.Owner.LoginName, siteCollectionOuter.Owner.Name, siteCollectionOuter.Owner.Email); //Hangs here                    site.PortalName = "Portal";
                site.PortalUrl = mainUrl; // https://www.ourdomain.net
                url = site.Url;
            }
        });

        return url; //Should be "https://www.outdomain.net/sites/siteName"

    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文