Error en el servicio importación después de Instalar June 2011 CU - System.PlatformNotSupportedException: Microsoft SharePoint is not supported with version 4.0.30319.235

Hola a todos

Ayer por la mañana ya se veían algunos comentarios en nuestras listas de distribución interna sobre un posible problema con el servicio de instalación de usuarios después de la instalación de SP 2010 SP1 y del June 2011 CU. El error era el siguiente:

Síntoma: User Profile import stop working with stopped-extension-dll-exception” errors in miiserver.exe (El servicio de importación reporta errores en miiserver FIM)

Call Stack:

"System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.PlatformNotSupportedException: Microsoft SharePoint is not supported with version 4.0.30319.235 of the Microsoft .Net Runtime.
at Microsoft.SharePoint.Administration.SPConfigurationDatabase.get_Farm()
at Microsoft.SharePoint.Administration.SPFarm.FindLocal(SPFarm& farm, Boolean& isJoined)
at Microsoft.SharePoint.WebControls.SPControl.SPWebEnsureSPControl(HttpContext context)
at Microsoft.SharePoint.SPContext.get_Current()
at Microsoft.Office.Server.UserProfiles.ProfileManagerInstance.GetApplicationProxy()
at Microsoft.Office.Server.UserProfiles.ProfileImportExportService.FinalizeProfileImportExportProcess(Int64 importExportId)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Office.Server.WebServiceDirectProxy.WebMethodInfo.Invoke(Object webServiceInstance, Object[] args)
at Microsoft.Office.Server.WebServiceDirectProxy.Invoke(String methodName, Object[] args)
at Microsoft.Office.Server.UserProfiles.ManagementAgent.ProfileImportExportDirect.FinalizeProfileImportExportProcess(Int64 importExportId)
at Microsoft.Office.Server.UserProfiles.ManagementAgent.ProfileImportExportExtension.Microsoft.MetadirectoryServices.IMAExtensibleCallExport.EndExport()
Forefront Identity Manager 4.0.2450.34"

Pues esta mañana nuestro compañero Patrick Heyde propone dos workarounds a la excepción:

1.- Desinstalación de .net 4.0 

 Como sabéis SharePoint 2010 esta basado en .net 3.5 . De hecho Microsoft no recomienda tener instalado .net 4.0 en el mismo box que SharePoint 2010 en entornos de producción.

2.- Modificar el archivo de configuración miiserver.config.exe

Como forzar el servicio FIM a ejecutar en .net 2.0

1.- Abrir el archivo C:\Program Files\Microsoft Office Servers\14.0\Synchronization Service\Bin\miiserver.config.config.exe

2.- Localizar la siguiente entrada

 <startup useLegacyV2RuntimeActivationPolicy="true">
                <supportedRuntime version="v4.0.30319"></supportedRuntime>
                <supportedRuntime version="v2.0.50727"></supportedRuntime>
</startup>

3.- Comentar la línea referente a .net 4.0.

<startup useLegacyV2RuntimeActivationPolicy="true">

<!-- <supportedRuntime version="v4.0.30319"></supportedRuntime> -–>

           <supportedRuntime version="v2.0.50727"></supportedRuntime>

</startup>

4.- Reiniciar los dos servicios asociados a FIM.

5.- Comenzar de nuevo la sincronización

El post original en Ingles del Blog de Patrick se encuentra en la siguiente dirección https://blogs.technet.com/b/patrick_heyde/archive/2011/07/02/sharepoint-2010-junecu-2011-available-side-effect-info-amp-solution.aspx

La información tambien está disponible desde hace unas horas en la sección Common issues y workaround del cumulativo https://support.microsoft.com/default.aspx?scid=kb;EN-US;2536599

Un saludo.

Héctor Calvarro Martín. SharePoint Dev. Microsoft Support Engineer for DEV EMEA