Revised the code as:
public ESRI.ArcGIS.Location.RouteMeasureLineLocationClass GetRouteMeasureClass(ESRI.ArcGIS.Location.IDatabaseLocatorWorkspace ws, string fName) {
IFeatureWorkspace fWs = (IFeatureWorkspace)ws;
ESRI.ArcGIS.Location.RouteMeasureLineLocationClass fcLoc = (ESRI.ArcGIS.Location.RouteMeasureLineLocationClass)(fWs.OpenFeatureClass(fName));
return (ESRI.ArcGIS.Location.RouteMeasureLineLocationClass)(fWs.OpenFeatureClass(fName));
}
Got The runtime error at the Line: Unable to cast COM object of type 'System.__ComObject' to interface type 'ESRI.ArcGIS.Location.IRouteLocation'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{354B908D-3BBA-11D4-9FCC-00C04F6BDF06}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).