none
New Type Initializer Error on Microsoft.Web.Administration.ConfigurationManager RRS feed

  • Question

  • We have an internal web application that remotely manages IIS web sites using ServerManager. This has worked perfectly for over a year. Last recorded log showing it working correctly was on 8/15/2013 (this process runs once a month). However, for the last week we are now getting the error message, "The type initializer for 'Microsoft.Web.Administration.ConfigurationManager' threw an exception.

    The error is thrown when the code runs on the same server we want to manage or from another server. It runs fine from my local machine against the remote server.

    Web Application Configuration

    • VS.Net 2010 & VS.Net 2012
    • .NET Framework 4
    • C# Web Application
    • Microsoft.Web.Administration Runtime version: v2.0.50727; specific version: false; copy local: true
    • Microsoft.Web.Management version: v2.0.50727; specific version: false; copy local: true

    I have attempted to require a specific version of the assembly and copy local but it doesn't help.

    The following code throws the type exception

    using Microsoft.Web.Administration;
    using System;
    using System.Web;

    public static bool IsIisInstalled(string serverName) { bool isInstalled; ServerManager iisManager = null; try { iisManager = ServerManager.OpenRemote(serverName); isInstalled = iisManager.Sites.Count >= 0; } catch (System.Runtime.InteropServices.COMException) { isInstalled = false; } catch (Exception ex) { //Type error thrown here throw ex; } finally { if (iisManager != null) iisManager.Dispose(); } return isInstalled; }


    • Moved by Eason_H Wednesday, September 11, 2013 5:29 AM
    Tuesday, September 10, 2013 3:53 PM

Answers

  • Hi RealCode,

    You'll need to post it in the dedicated ASP.Net Forum http://forums.asp.net for more efficient responses, where you can contact ASP.NET experts.

    Thanks


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 11, 2013 5:29 AM

All replies

  • Hi,

    Is version of Microsoft.Web.Administration is 7.0.0.0?


    Regards
    Nayan Paregi (MCTS)
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Wednesday, September 11, 2013 3:02 AM
  • Hi RealCode,

    You'll need to post it in the dedicated ASP.Net Forum http://forums.asp.net for more efficient responses, where you can contact ASP.NET experts.

    Thanks


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 11, 2013 5:29 AM
  • It is Version 7.9.0.0
    Monday, September 30, 2013 2:24 PM