Changing the MySite Url broke the Activity Feed

Yesterday I was confronted with the issue of a changed My Site Url. The client had asked to change http://mysite to

The first step is to recreate the Web Application with the new primary Url and set up IIS (certificates). You could extend but they didn't require multiple zones so we didn't do that.

Then you have to go into the User Profile Service Application and change the My Site Host Url. That's easy as well.

Don’t forget to update the Search Content Sources (http://mysite and sps3://mysite).

At this point we were receiving issues on the Activity Feed:

SPSocialFeedManager.GetFeedFor: Exception: System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it    ​
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)     at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)    
--- End of inner exception stack trace ---    
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)    
at System.Net.HttpWebRequest.GetRequestStream()    
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)    
at Microsoft.Office.Server.Social.SPSocialFeedManagerProxy.ExecuteQuery[T](Func`1 func)    
at Microsoft.Office.Server.Social.SPSocialFeedManagerProxy.Microsoft.Office.Server.Social.ISocialFeedManagerProxy.ProxyGetFeedFor(String actorId, SPSocialFeedOptions options)    
​ at Microsoft.Office.Server.Social.SPSocialFeedManager.<>c__DisplayClass4b`1.b__4a()

​Somewhere a reference to the 'old' MySite Url was still kept. After a bit of digging it appeared to be in the User Profiles themselves. The 'Feed service provider defined identifier' property (internally known as SPS-FeedIdentifier) pointed to the old absolute MySite Url.

My User Profile

Nothing a quick PowerShell script can't fix:

$mshUrl = ""
$site = New-Object Microsoft.SharePoint.SPSite($mshUrl)
$context = [Microsoft.Office.Server.ServerContext]::GetContext($site)
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$profiles = $upm.GetEnumerator()

foreach ($profile in $profiles)
  if ($profile["SPS-FeedIdentifier"] -ne $null)
    $profile["SPS-FeedIdentifier"].Value = $profile["SPS-FeedIdentifier"].Value.Replace("http://mysite", $mshUrl);

After this the Activity Feed works again.



Wednesday, 4 Sep 2013 11:54 by Thomas Vochten
Nice post! For your information: you can delete the only IIS website from a web application without deleting the web app itself. You end up with a web application without websites. After that just extend the web application to a new website in the default zone.

Wednesday, 4 Sep 2013 11:59 by Steven Van de Craen
Hi Thomas, I didn't know that. It can be very useful to preserve all settings on the Web Application yet change the IIS sites. Thanks !!

Wednesday, 1 Oct 2014 04:04 by Jeroen Schoenmakers
Very very nice post, thank you very much; ran into this exact issue today after renaming the MySite Host URL. Like you say in the beginning of your article, extending is definitely not always a good option e.g. when the original name is plain wrong, you don't want to sit with that wrong name until the end of days! Not many articles make note of this. Thanks again for the efforts! Jeroen

CAPTCHA Image Validation