Open a SPWeb object to a load balanced farm
19. March 2007 05:56
I was working on some quick utilities to address some upgrade bugs in Sharepoint 2007, and ran across some problems opening connections to a load balanced farm via the object model.

Here is a way that works, if you've got something better let me know!

           SPWebService myWebService = SPWebService .ContentService;

            SPWebApplication myWebApp = myWebService.WebApplications[ "web app name" ];

            SPSite mySite = myWebApp.Sites[BaseURL];

            SPWeb myWeb = mySite.OpenWeb();

Where 'web app name' is the name of the web app as you see it in IIS.  (e.g. "SPS Portal - 80")

Tags: Comments (0) | Permalink

Comments

Comments are closed