שאלות נפוצות
PME 8.x: Unable to load framework [Alarm Configuration Crashes & Alarm Annuciator does not appear in Web Applications]
Issue
When trying to launch the Alarm Configuration web site you encounter an "Unable to load framework" error. The Alarm Annuciator does not appear. In the ApplicationModules database Diagnostics.LogEventView errors like this are seen:
AlarmRollupCounts Exception has been thrown by the target of an invocation. [AlarmRollupCounts][General] LogClientException: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->
System.NullReferenceException: Object reference not set to an instance of an object.
at Providers.DataAccess.AlarmProviders.ConvertAlarmRollupCounts(List`1 resultData)
at Providers.DataAccess.AlarmProviders.AlarmRollupCounts()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Modules.ProviderBase.ProviderCommonBase.WorkerMethod()
LogClient: Modules.ProviderBase::Modules.ProviderBase.ProviderCommonBase::ReportFailure
The following error may be also observed under the 'Message' column in the Diagnostics.LogEvent table found within the ApplicationModules database.
A problem occurred on page 'http://[SERVERNAME]/SystemDataService/Applications/ConfigurationApplications': Method not found: 'Newtonsoft.Json.Linq.JToken Newtonsoft.Json.Linq.JObject.GetValue(System.String, System.StringComparison)'.
Product Line
Power Monitoring Expert 8.x
Cause
An incompatible version of the 3rd party assembly Newtonsoft.Json.dll has been installed into the Global Assembly Cache (GAC). PME ships with Newtonsoft.Json.dll Product version 5.0.8.16617. PME does not install assemblies into the GAC. However if another application installs the Newtonsoft.Json.dll into the GAC that version of the assembly will be loaded by the .Net Runtime. Earlier versions of Newtonsoft.Json.dll had a bug related to deserializing and if those versions are used by a PME process it will crash.
The GAC can be typically found here, C:\Windows\Microsoft.NET\assembly\GAC_MSIL . If Newtonsoft is installed into the GAC you will find the following subfolders \Newtonsoft.Json\v4.0_4.5.0.0__30ad4fe6b2a6aeed. Inside will be the Newtonsoft.Json.dll and chances are it will be a lower Product Version then PME requires, most likely 4.5.7.15008.
There is no way to force .Net to use the version of Newtonsoft.Json.dll that ships with PME. The author of the assembly refuses to increment the Assembly version and has locked it at version 4.5.0.0 for all versions. To the .Net Framework the version PME ships looks identical to the version registered in the GAC and so the one in the GAC is used.
Resolution
1) Upgrade the version of Newtonsoft.Json.dll in the GAC. If the Product version of the assembly in the GAC is lower than 5.0.8.16617 then it can be upgraded. This is the recommended corrective action as this has the lowest chance of affecting other non-PME applications which use the Newtonsoft.Json.dll. A simple file replacement should resolve the issue but all associated processes which are utilizing the dll file will need to be stopped.
#Note that you should be running PowerShell as an Administrator
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacRemove("C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_4.5.0.0__30ad4fe6b2a6aeed\Newtonsoft.Json.dll")
#If installing into the GAC on a server hosting web applications in IIS, you need to restart IIS for the applications to pick up the change.
#Uncomment the next line if necessary...
iisreset
After the Powershell has finished the C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_4.5.0.0__30ad4fe6b2a6aeed folder should be empty. Restart the ApplicationModules services (CoreServicesHost, DataServicesHost and ProviderEngineHost) for the changes to be reflected on the system.
When trying to launch the Alarm Configuration web site you encounter an "Unable to load framework" error. The Alarm Annuciator does not appear. In the ApplicationModules database Diagnostics.LogEventView errors like this are seen:
AlarmRollupCounts Exception has been thrown by the target of an invocation. [AlarmRollupCounts][General] LogClientException: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->
System.NullReferenceException: Object reference not set to an instance of an object.
at Providers.DataAccess.AlarmProviders.ConvertAlarmRollupCounts(List`1 resultData)
at Providers.DataAccess.AlarmProviders.AlarmRollupCounts()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Modules.ProviderBase.ProviderCommonBase.WorkerMethod()
LogClient: Modules.ProviderBase::Modules.ProviderBase.ProviderCommonBase::ReportFailure
The following error may be also observed under the 'Message' column in the Diagnostics.LogEvent table found within the ApplicationModules database.
A problem occurred on page 'http://[SERVERNAME]/SystemDataService/Applications/ConfigurationApplications': Method not found: 'Newtonsoft.Json.Linq.JToken Newtonsoft.Json.Linq.JObject.GetValue(System.String, System.StringComparison)'.
Product Line
Power Monitoring Expert 8.x
Cause
An incompatible version of the 3rd party assembly Newtonsoft.Json.dll has been installed into the Global Assembly Cache (GAC). PME ships with Newtonsoft.Json.dll Product version 5.0.8.16617. PME does not install assemblies into the GAC. However if another application installs the Newtonsoft.Json.dll into the GAC that version of the assembly will be loaded by the .Net Runtime. Earlier versions of Newtonsoft.Json.dll had a bug related to deserializing and if those versions are used by a PME process it will crash.
The GAC can be typically found here, C:\Windows\Microsoft.NET\assembly\GAC_MSIL . If Newtonsoft is installed into the GAC you will find the following subfolders \Newtonsoft.Json\v4.0_4.5.0.0__30ad4fe6b2a6aeed. Inside will be the Newtonsoft.Json.dll and chances are it will be a lower Product Version then PME requires, most likely 4.5.7.15008.
There is no way to force .Net to use the version of Newtonsoft.Json.dll that ships with PME. The author of the assembly refuses to increment the Assembly version and has locked it at version 4.5.0.0 for all versions. To the .Net Framework the version PME ships looks identical to the version registered in the GAC and so the one in the GAC is used.
Resolution
1) Upgrade the version of Newtonsoft.Json.dll in the GAC. If the Product version of the assembly in the GAC is lower than 5.0.8.16617 then it can be upgraded. This is the recommended corrective action as this has the lowest chance of affecting other non-PME applications which use the Newtonsoft.Json.dll. A simple file replacement should resolve the issue but all associated processes which are utilizing the dll file will need to be stopped.
- In the Internet Information Services (IIS) Manager, right-click on the servername and click on "Stop".
- Stop the ApplicationModules services (CoreServicesHost, DataServicesHost and ProviderEngineHost), ION Reporter subscription service and World Wide Web publishing service.
- Backup the "Newtonsoft.Json.dll" file found in "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_4.5.0.0__30ad4fe6b2a6aeed" to a different location.
- Copy the "Newtonsoft.Json.dll" file found in "C:\Program Files (x86)\Schneider Electric\Power Monitoring Expert\web\bin" to "Newtonsoft.Json.dll" file found in "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_4.5.0.0__30ad4fe6b2a6aeed".
- Start the ApplicationModules services (CoreServicesHost, DataServicesHost and ProviderEngineHost), ION Reporter subscription service and World Wide Web publishing service.
- Perform an IIS reset via the command prompt window using the command "iis reset".
- In the Internet Information Services (IIS) Manager, right-click on the servername and click on "Start".
- Log into Web Applications.
#Note that you should be running PowerShell as an Administrator
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacRemove("C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_4.5.0.0__30ad4fe6b2a6aeed\Newtonsoft.Json.dll")
#If installing into the GAC on a server hosting web applications in IIS, you need to restart IIS for the applications to pick up the change.
#Uncomment the next line if necessary...
iisreset
After the Powershell has finished the C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_4.5.0.0__30ad4fe6b2a6aeed folder should be empty. Restart the ApplicationModules services (CoreServicesHost, DataServicesHost and ProviderEngineHost) for the changes to be reflected on the system.