I've encountered this problem earlier already. This time I was moving my development environment from one desktop to another and the issue came back. Note that to move my solution from the old environment to the new one I copied its entire solution folder. When opened in a new desktop, using the same version of the Visual Studio 2010
, the following code:
using (ServerManager serverManager = new ServerManager())
{
//Go through all the sites
for (int s = 0; s < serverManager.Sites.Count; s++) //EXCEPTION HERE!!!
{
//Do work
}
}
Produced this exception:
GetAdminSection; GetSectionInternal; SitesSectionCreator; Initialize;
SitesCollectionCreator; Initialize; collectData.
Filename: redirection.config
Error: Cannot read configuration file
Why would it do so if it was running absolutely fine on an old desktop... Anyway, my question:
What is the proper way to include the Microsoft.Web.Administration
assembly reference?
The way I currently did it is by linking to this dll via Solution
-> References
-> Add reference
-> Browser
and then point to this file:
C:\Windows\System32\inetsrv\Microsoft.Web.Administration.dll
My concern is that this exception will pop up on a production machine when my solution is deployed there.