Help required on .Net CLR version setting on application pool of IIS 8.5 RRS feed

  • Question

  • We have a WCF service hosted under IIS 8.5 and runs under an application pool where the .Net Clr version is choosen as v4.0 as our application target Framework is 4.6.

    This WCF service is VB.Net code and uses c++ clr code dll for some functionality. Randomly the application users start to get errors as "The type initializer for '<Module>' threw an exception. The C++ module failed to load while attempting to initialize the default appdomain."

    <o:p>Again this is random and most of the time code works, but once error starts we end up doing IISReset to resolve this.</o:p>

    After trying to find solution online, suggestion was to add <o:p></o:p>

    <startup useLegacyV2RuntimeActivationPolicy="true"><o:p></o:p>

      <supportedRuntime version="v4.0"/><o:p></o:p>


    But seems this setting would not work for web.config. After this we tried to change the .Net Clr version to v2.0 in application pool  and the error does not reproduce.<o:p></o:p>


    1. IS there a way to add the useLegacyV2RuntimeActivationPolicy in web.config<o:p></o:p>

    2. or any other alternative to get this working by still setting the v4.0 on IIS application pool?



    Monday, December 4, 2017 6:44 AM

All replies

  • Hi Sidd J,

    Thank you for posting here.

    According to your question is more related to IIS, you could post a new thread in IIS forum for suitable support.

    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions. 

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, December 6, 2017 12:56 AM