An error occurred whilst getting the MySites host url. Reason: Exception calling “.ctor” with “1” argument(s)

Coordinator
Sep 14, 2012 at 8:52 AM
Edited Sep 14, 2012 at 10:38 AM

All,

If you encounter an error: An error occurred whilst getting the MySites host url. Reason: Exception calling “.ctor” with “1” argument(s) check the permissions on the User Profile Service Application for the account executing the script. You will need to add Full Control permissions for the executive account to the service application.

Thanks

 

 

Sep 19, 2012 at 12:48 PM
Edited Sep 19, 2012 at 1:39 PM

Hi,

I get the same message but I can't modify the "User Profile Service Application" because I don't have installed the service application. In params.xml I used FALSE for "includemysites".

What can I do?

Coordinator
Sep 19, 2012 at 2:51 PM

Hi Paul

Ok so looks like i need to include an exception for such cases.

I assumed that everyone using Standard or Enterprise will be using My Sites.  Sorry....

Sep 20, 2012 at 5:44 AM

Hi mardendd,

that would be great, thanks for help.

Paul

Coordinator
Sep 26, 2012 at 3:49 PM
Edited Dec 18, 2013 at 11:43 AM
Can you please mail me at <REMOVED> so that I can mail you some code snippets. I don't have an environment that uses Standard/Enterprise which does not have MySites so I will need to mail you the code so we can test.  
Oct 5, 2012 at 10:48 AM

I'm still getting the exact same error, and I've given the backup user Full Control permissions to the User Profile Service Application. I've tried fiddling with calling the cmdlets manually and no matter what I do new'ing UserProfileManager produces the exception as stated. As a temporary workaround I've added a return statement at the top of the method and the rest of the backup runs fine.

I'm running 2010 Enterprise and have User Profile Service Application running.

Coordinator
Oct 5, 2012 at 2:08 PM

Hi xorandor

Can I just double check....Youve added the account executing the script to both the Administrators with Full Control and the Permissions on the User Profile Service App

 http://littletalk.files.wordpress.com/2010/05/11-05-2010-10-01-50-am.jpg

 

Oct 8, 2012 at 9:55 AM

Good man, you are spot on!

I had only given full control under "administrators". Thanks!

Marked as answer by marsdendd on 12/18/2013 at 5:04 AM
Coordinator
Nov 6, 2012 at 11:25 AM
Paul2324r wrote:

Hi,

I get the same message but I can't modify the "User Profile Service Application" because I don't have installed the service application. In params.xml I used FALSE for "includemysites".

What can I do?


Hi Paul,

I have been looking at this recently and have an Enterprise farm running the configuration you mention above. i.e no User profile Service Application, and the script executed and completed with out issue.

If you can get back in touch, the we can work this one through.

Darren

Nov 28, 2012 at 9:57 PM

I'm also getting this error. I've also set the "includemysites" to FALSE for testing and the error persists. I ran it debugging and found that it fails calling line 1465:

$svcContext = Get-SPServiceContext($GLOBAL:webApplicationUrl) -ErrorAction Stop

That returns a guid of all zero's! The following line causes the exception since the context is obviously invalid. This may be because I'm using a multi-tenant partitioned setup. In this setup there are many URL's for the single Web Application and the root one of http(s)://[servername] doesn't work! It's only a placeholder. For now I will comment out the code that checks for whether to back up mysites and just always back them up.

Great job on the script though! It's more than I need but seems to work very well and is well written and documented!

Thanks,

Jim

Nov 30, 2012 at 7:55 AM

Hi Guys,

I've just upgraded to v2.2 and am getting the same error above.  Is it OK to comment out this function if we know we wont need it?

Current Config:

  • SP2010 SP1 Enterprise
  • No User Profile Service Application
  • SPFarmBackup v2.2

P.s. Darren - Great work. Have been using this script for a while now!

Regards

Craig

Coordinator
Nov 30, 2012 at 10:33 AM
Edited Nov 30, 2012 at 10:35 AM

Hi All,

I have rewritten the function and will post up the new version 2.3 very soon. Just a little more testing

Essentially there are three errors that occur:

Error: Exception calling ".ctor" with "1" argument(s): "Object reference not set to an instance of an object."
  
Error: Exception calling ".ctor" with "1" argument(s): "No User Profile Application available to service the request. Contact your farm administrator."

Error: Cannot find type [Microsoft.Office.Server.UserProfiles.UserProfileManager]: make sure the assembly containing this type is loaded.

Thanks for your patience.

Darren

Dec 13, 2012 at 1:57 PM

Hi Darren,

Any news on the new version?

Dec 14, 2012 at 1:25 PM

Darren - If it's worth anything, we have Enterprise and do not use MySites.  -Rob

Dec 18, 2012 at 6:48 PM
Edited Dec 18, 2012 at 7:03 PM

Hi Darren -

First off, excellent work on this backup script.  It looks very comprehensive, thanks for taking the time and energy.  I'm stumped, though.  I've got the User Profile Service application set with the account running the script having Full Control on both the Permissions and Administrators section of the manage service app.  I've checked SQL db permissions, tried IISresets, farm server reboots, stopping/starting the User Profile service... all without any luck.  We're running SP 2010 with SP1 Enterprise and have MySites provisioned.  Any other ideas to get this glorious script working would be awesome!  Thanks again,

 

Tom

Coordinator
Dec 18, 2012 at 7:18 PM

Hi Tom/Rob et al

The new version is ready  with all outstanding problems solved.

Tom if you send me a message direct I will mail the new version over to you tonight or you can wait until I upload the new release.

Regards

Darren

 

 

Dec 18, 2012 at 7:46 PM

Tom - I am curious about your post. What is your issue with the User Profile Service Application? Can you provide some more details? Reason I ask is I ran just a straight Backup-SPFarm command and it killed this service. I had to start that service app back up manually. (This issue was not in any way related to Darren's script.)

Coordinator
Dec 18, 2012 at 7:50 PM
robc wrote:

Tom - I am curious about your post. What is your issue with the User Profile Service Application? Can you provide some more details? Reason I ask is I ran just a straight Backup-SPFarm command and it killed this service. I had to start that service app back up manually. (This issue was not in any way related to Darren's script.)


Hi Rob,

Have you read my Blog posts on the USP issues caused by the Backup-SPFarm cmdlet?

There are some key actions and requirements that need to be adhered to.

http://www.darrenmarsden.com/post/2012/04/04/SharePoint-Backup-breaks-User-Profile-Service.aspx

Dec 18, 2012 at 7:53 PM

Hi robc,

We're just noticing the following right before the script quits:

Error: An error occurred whilst getting the MySites host Url. Reason: Exception calling ".ctor" with "1" argument(s): "No User Profile Application available to service the request. Contact your farm administrator."

We had tried updating the permissions mentioned earlier in the thread, to no avail.  Otherwise, our User Profile Service app seems to be fine.

Dec 18, 2012 at 7:54 PM

Awesome, thanks Darren! I'll message you direct

Dec 18, 2012 at 8:15 PM

I hadn't seen that, good post. I have the farm account included in the local admin group, didn't do an IIS reset but eventually I did bounce the servers ..... I just shake my head at MS ....

Jan 8, 2013 at 12:19 PM
Hi Darren

Where do i find the new verison ?

 

Coordinator
Jan 8, 2013 at 9:23 PM
torbenhvolby wrote:
Hi Darren

Where do i find the new verison ?

 


Hi Torben, the new version is uploaded and available for download now.

The issue is now resolved in v2.3

Darren

Mar 18, 2013 at 9:29 AM
Hi,
today I upgraded to 2.3 and set <backupsites> to "TRUE".

Sadly I am still get the error: Warning: An error occurred whilst determining the My Site Host. Reason: Exception calling ".ctor" with "1" argument(s): "No User Profile Application available to service the request. Contact your farm administrator."

I don't have the "User Profile Service Application" installed but I like to backup single sites.
Coordinator
Mar 18, 2013 at 10:16 AM
Edited Mar 18, 2013 at 10:45 AM
Hi

As you will see the error message is now a warning and does not exit the script when this error is tripped.

Instead it merely logs and continues. This should not prevent the backup of your sites from completing successfully.

I will test again anc come back to you, in the meantime can you post your backup logfile.

Thanks

EDIT:

Ok just tested and here is an extract from my logfile:

18-Mrz-2013 11:35:08 Info: Checking that My Site Host exists and is accessible.
18-Mrz-2013 11:35:08 Warning: An error occurred whilst determining the My Site Host. Reason: Exception calling ".ctor" with "1" argument(s): "No User Profile Application available to service the request. Contact your farm administrator."
18-Mrz-2013 11:35:08 Info: Include MySites is set to: FALSE. Skipping backup of MySites.
18-Mrz-2013 11:35:08 Info: Performing backup of all site collection(s) in web application: http://recordsdev.mydomain.com.
18-Mrz-2013 11:35:12 Info: Site lock state set to Unlock on site http://appsdev.mydomain.com
18-Mrz-2013 11:35:12 Info: Backup of SharePoint site collection http://appsdev.mydomain.com successfully completed.
18-Mrz-2013 11:35:12 Info: Performing backup of all site collection(s) in web application: http://recordsdev.mydomain.com.
18-Mrz-2013 11:35:14 Info: Site lock state set to Unlock on site http://collaborationdev.mydomain.com
18-Mrz-2013 11:35:14 Info: Backup of SharePoint site collection http://collaborationdev.mydomain.com successfully completed.
18-Mrz-2013 11:35:16 Info: Site lock state set to Unlock on site http://collaborationdev.mydomain.com/sites/site01
18-Mrz-2013 11:35:16 Info: Backup of SharePoint site collection http://collaborationdev.mydomain.com/sites/site01 successfully completed.
18-Mrz-2013 11:35:16 Info: Performing backup of all site collection(s) in web application: http://recordsdev.mydomain.com.
18-Mrz-2013 11:35:19 Info: Site lock state set to ReadOnly on site http://communitiesdev.mydomain.com
18-Mrz-2013 11:35:19 Info: Backup of SharePoint site collection http://communitiesdev.mydomain.com successfully completed.
18-Mrz-2013 11:35:19 Info: Performing backup of all site collection(s) in web application: http://recordsdev.mydomain.com.
18-Mrz-2013 11:35:21 Info: Site lock state set to Unlock on site http://mysitedev.mydomain.com
18-Mrz-2013 11:35:21 Info: Backup of SharePoint site collection http://mysitedev.mydomain.com successfully completed.
18-Mrz-2013 11:35:21 Info: Performing backup of all site collection(s) in web application: http://recordsdev.mydomain.com.
18-Mrz-2013 11:35:24 Info: Site lock state set to ReadOnly on site http://recordsdev.mydomain.com
18-Mrz-2013 11:35:24 Info: Backup of SharePoint site collection http://recordsdev.mydomain.com successfully completed.
18-Mrz-2013 11:35:26 Info: Site lock state set to Unlock on site http://recordsdev.mydomain.com/crm/bugorg01
18-Mrz-2013 11:35:26 Info: Backup of SharePoint site collection http://recordsdev.mydomain.com/crm/bugorg01 successfully completed.
18-Mrz-2013 11:35:28 Info: Site lock state set to ReadOnly on site http://recordsdev.mydomain.com/crm/masterorg01
18-Mrz-2013 11:35:28 Info: Backup of SharePoint site collection http://recordsdev.mydomain.com/crm/masterorg01 successfully completed.
18-Mrz-2013 11:35:29 Info: Site lock state set to Unlock on site http://recordsdev.mydomain.com/crm/patchorg01
18-Mrz-2013 11:35:29 Info: Backup of SharePoint site collection http://recordsdev.mydomain.com/crm/patchorg01 successfully completed.
18-Mrz-2013 11:35:29 Info: Selected backup option: [0]. FULL: Selected day(s) as stipulated in params.xml & DIFF: Remaining Days
18-Mrz-2013 11:35:29 Info: Performing SharePoint DIFFERENTIAL farm backup.

Essentially, it warns (logs) there is no User Profile Application and continues.



Just spotted something.......What is the setting of your MySites. Is it set to TRUE or FALSE?

EDIT AGAIN.....

OK Just tested with MySites set to TRUE and FALSE and both worked as anticipated.

Darren
Dec 18, 2013 at 11:23 AM
Hi,

I see this discussion, hope I am not to late .....

I also have this error come by after creating a new UPS in the farm ...... had some issues and needed a new one.

Since my backup fails with the following message,

____18-dec-2013 13:05:16 Error: An error occurred whilst getting the MySites host Url. Reason: Exception calling ".ctor" with "1" argument(s): "No User Profile Application available to service the request. Contact your farm administrator."
18-dec-2013 13:05:16 Result: SharePoint site/farm backup job exited prematurely with error(s).____

I looked at the administrators mentioned and the permissions but they all seems to be okay. Do I have to set the news UPS in the farm somewhere on the job ?

do you have any suggestions ?
Coordinator
Dec 18, 2013 at 11:58 AM
Edited Dec 18, 2013 at 11:59 AM
Hi,

First, please confirm that you have set Administrators and the Permissions option with FULL CONTROL for the account running the backup (if using Scheduled Task must be account launching Scheduled Task) on BOTH on the User Profile Service App (see link)

http://littletalk.files.wordpress.com/2010/05/11-05-2010-10-01-50-am.jpg



Next thing.....can you turn on the verbose logging in Diagnostic Logging under SharePoint Foundation > Backup and Restore

http://<Server>:<Port>/_admin/metrics.aspx

Did you recreate the DB's when you recreated the UPS or did you recreate using the existing DB's?

Then we can run a Merge-SPLogfile to extract the log entries for Backup and restore whilst running the backup.
Coordinator
Dec 18, 2013 at 12:03 PM
Edited Dec 18, 2013 at 12:03 PM
Oh one other thing.....what do you have set in the My Site Host field it should be something along the lines of: __http://mysite.mydomain.com:80/__
Dec 18, 2013 at 12:51 PM
Hi,
I think I created the three databases newly by creating the new UPS, I think so because I used the original names and he did not mention their presence.

I will start the verbose logging soon ....