In Dekstop 10.3.1 File->Add Data->Add Query layer:
Use this query:
SELECT dbo.RARE_VIEW_LOCATIONS.LOC_NAME, dbo.RARE_VIEW_LOCATIONS.LOC_NOTES, dbo.RARE_VIEW_LOCATIONS.WATERSHED, dbo.RARE_VIEW_LOCATIONS.COUNTY, dbo.RARE_VIEW_LOCATIONS.STATE, dbo.RARE_VIEW_LOCATIONS.LOCATIONDESCRIPTION, dbo.RARE_VIEW_LOCATIONS.LOCATIONNOTES, dbo.RARE_VIEW_LOCATIONS.FCSubtype, dbo.RARE_VIEW_LOCATIONS.SPECCOM, dbo.RARE_VIEW_LOCATIONS.Location_Type, dbo.RARE_tbl_Events.Start_Date, dbo.RARE_tbl_Events.Observation_NOTES, dbo.RARE_tbl_Events.EditDate, dbo.RARE_tbl_Events.Event_ID, dbo.RARE_tlu_Species.taxaGroup, dbo.RARE_tlu_Species.Genus, dbo.RARE_tlu_Species.Species, dbo.RARE_tlu_Species.Species_GUID, dbo.RARE_VIEW_LOCATIONS.LOCATION_ID, dbo.RAREPOINT.SHAPE, dbo.RAREPOINT.GIS_LOCATION_ID FROM dbo.RARE_tlu_Species INNER JOIN dbo.RARE_tbl_Events ON dbo.RARE_tlu_Species.Species_ID = dbo.RARE_tbl_Events.Species_ID INNER JOIN dbo.RARE_VIEW_LOCATIONS ON dbo.RARE_tbl_Events.Location_ID = dbo.RARE_VIEW_LOCATIONS.LOCATION_ID INNER JOIN dbo.RAREPOINT ON dbo.RARE_VIEW_LOCATIONS.OBJECTID = dbo.RAREPOINT.OBJECTID WHERE (dbo.RARE_tlu_Species.Species_GUID = 'abcd1234')
Publish to SVR 10.3.1 as a map service with dynamic workspace enabled.
Works.
Publish to SVR 10.4
as a map service with dynamic workspace enabled.
Works.
In ArcMap, instead of a query layer, make a view in SQL and add the view to TOC.
Publish to SVR 10.3.1 as a map service with dynamic workspace enabled.
Works.
Publish to SVR 10.4
as a map service with dynamic workspace enabled.
Fails
Failed to create the service.: Updating the server connection string for layer RARE.dbo.Spatial_View_Hellbender failed. Attempted connection string was SERVER=AASABBBB;INSTANCE="DSID=4ad33bec-ac5e-43b6-984a-ddfc1f78df98";DBCLIENT=sqlserver;DB_CONNECTION_PROPERTIES=AASABBBB;DATABASE=RARE;VERSION=dbo.DEFAULT;AUTHENTICATION_MODE=OSA. Table name is RARE.DBO.%Spatial_View_Hellbender. Please verify the data exists on the server..
Error executing tool. PublishServiceDefinition Job ID: j6fcd5f1eea7b45829411fed0e4178aaa : ERROR 001487: Failed to update the published service with the server-side data location. Please see the server's log for more details. (less) ERROR 001369: Failed to create the service. Failed to execute (Publish Service Definition).
In all cases:
SQL is 2014 Enterprise, feature class is Geography Storage type non-versioned, SDE 10.3.1, Windows Auth ONLY, service acccount(s) have correct permission to the tables and views.
Since publishing a SQL view works in SVR 10.3.1, and doesn't work in 10.4, I'm leaning towards there's nothing wrong with my data and something wrong with 10.4.
Publishing a "regular" table (feature class) works in 10.4 as a map/feature service.