Time out when creating a site collection
Posted
by
Daeko
on Stack Overflow
See other posts from Stack Overflow
or by Daeko
Published on 2010-12-22T12:51:31Z
Indexed on
2010/12/22
12:54 UTC
Read the original article
Hit count: 178
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"
}
© Stack Overflow or respective owner