I am unable to publish the Map service in ArcGIS Server and my server is federated with Portal for ArcGIS.
Below is the issue while publishing the service:
Failed to create the service.: ERROR: code:500, 0x80004001 - Class not registered, Internal server error.
Core server call to create service failed (/admin/createService).
Failed to create the service 'UN_Gas_Network.MapServer'. com.esri.arcgis.discovery.servicelib.AGSException: AutomationException: 0x80004001 - Class not registered
I found this old GeoNet thread, seems to be some good advice in here -- Suddenly Can't Publish Feature Services? v10.3.
It may also be worthwhile to ensure that the ArcGIS Server service account permissions are set to all of the necessary install directories.