none
C# SharePoint 2010 Cannot create SiteCollection with new database RRS feed

  • Allgemeine Diskussion

  • Hello everybody,

    we have a problem when we want to create a new SiteCollection with a new database on an existing sharepoint 2010 server.

    We use the following command:

    SPSecurity.RunWithElevatedPrivileges(delegate()
                    {
                        using (SPSite site = new SPSite(SPContext.Current.Site.Url))
                        {
                        // Get the list of site collections for the web application 
                        SPSiteCollection siteCollection = site.WebApplication.Sites;
    
                        //Add the site collection                 
                        siteCollection.Add(siteURL,
                        title,
                        description,
                        lcid,
                        template,
                        @ownerLogin,
                        ownerName,
                        ownerEMail,
                        secondaryLogin,
                        secondaryName,
                        secondaryEMail,
                        databaseServer,
                        databaseName,
                        @databaseUser,
                        databaseUserPassword);
                            }
                    });
    The lcid is "1033" and the database user is our Farm Account which also created the sharepoint 2010 server.

    When the Add Method is executed we get the following error message: Cannot connect to database master at SQL server at sqlservername. The database might not exist, or the current user does not have permission to connect to it.

    But the user has all rights on the server and also can connect to it, even from another server via Management Studio.

    Rights: dbcreator; public; securityadmin, sysadmin

    Creating a new SiteCollection without a new database is working.

    Seperating the creation of the database and then creating the new SiteCollection in the new one also gives the same error when the database should be created.

    We tested this command on two developer server with SharePoint and SQL Server installed on the same machine.

    Because this error exists also when the server port ist not configured correctly, it's hard to search for my specific problem. So every help is much appreciated!

    Thanks in advance.

    Sebastian Neurohr

    • Typ geändert Alex Pitulice Montag, 3. Juni 2013 07:34 Warten auf Feedback
    Dienstag, 28. Mai 2013 07:37

Alle Antworten