SharePoint Service Application is Stuck on Starting
Honestly, I've never experienced this issue in any preceding SharePoint versions, but only on the current version (SharePoint 2016). While creating one of the SharePoint service applications using the Central Administration site (Application Management >> Manage Service Applications), it eventually fails with timeout error. Thus, checking the Service Applications page on the Central Administration site shows that the service application is there, but its status is Starting!
If you have a look on SharePoint ULS logs while the service application is being created, you will find similar records as the below:
xx/xx/xxxx xx:xx:xx.xx w3wp.exe 0x1AA0 SharePoint Foundation Topology fg4x High Ending asynchronous provisioning for service application with name 'BDC Service Application' and type 'Microsoft.SharePoint.BusinessData.SharedService.BdcServiceApplication'.
xx/xx/xxxx xx:xx:xx.xx w3wp.exe 0x1AA0 SharePoint Foundation Timer b9u7 High SPTimerJobAsyncResult '01d23aaf-7b11-4131-87e6-519b860597a9': Timer job has not completed. Blocking until job completes.
xx/xx/xxxx xx:xx:xx.xx w3wp.exe 0x1AA0 SharePoint Foundation Timer b9u9 High SPTimerJobAsyncResult '01d23aaf-7b11-4131-87e6-519b860597a9': An error occurred while waiting for completion: System.Threading.ThreadAbortException: Thread was being aborted. at System.Threading.Thread.SleepInternal(Int32 millisecondsTimeout) at System.Threading.Thread.Sleep(Int32 millisecondsTimeout) at Microsoft.SharePoint.Administration.SPJobDefinition.WaitForCompletion(TimeSpan timeout) at Microsoft.SharePoint.Administration.SPTimerJobAsyncResult.WaitForCompletion(Object state)
xx/xx/xxxx xx:xx:xx.xx w3wp.exe 0x1AA0 SharePoint Foundation Runtime tkau Unexpected System.Web.HttpException: Request timed out.
xx/xx/xxxx xx:xx:xx.xx w3wp.exe 0x1AA0 SharePoint Foundation General ajlz0 High Getting Error Message for Exception System.Web.HttpException (0x80004005): Request timed out.
Firstly, let's understand what happens under the hood while creating a new service application in SharePoint 2016. SharePoint 2016 is working based on the MinRole model which lets SharePoint farm administrators assign each server's role in a farm topology, and based on that, each server will run/host some of the farm services to be running on it. For full list of these services, please have a look on this article.
Hence, while creating a new service application in SharePoint, SharePoint will check first your servers in the farm, and detect which servers will have to start the service application services on. For instance, in our case we were creating a BCS service application; so, SharePoint wanted to start the service instance Business Data Connectivity Service on any server with MinRole (Front-end, Application, Front-end with Distributed Cache, and Application with Search).
N.B., we knew the servers that the service instance will start on based on the lastly mentioned article searching for the MinRoles which should run the service Business Data Connectivity Service.
Unfortunately, SharePoint won't complete the service application creation till the correspondent service instance is started on all the concerned servers in the farm. While waiting, if this is taking long time to start the service instance, the service application creation may timeout and cause this issue.
N.B., noticed that installing Feature Pack 1 for SharePoint 2016 resolves this issue. If your farm is not patched with Feature Pack 1, install it.
The Solution is simple, start the service instances on the concerned servers by yourself, and then create the service application. However, there are two things to be considered:
- If you don't have the service application, you won't be able to start its service instance using the Central Administration site (System Settings >> Manage Services on Server), unless this is a Custom MinRole. Hence, we will start the service instances using PowerShell.
- If the you don't have the service application, and you start the service instance, you will get a message beside the server in the Central Administration site (System Settings >> Manage Servers in this farm)that this server is not compliant! Beside this, you will find fix hyperlink, don't click it, as we will ignore this compliancy issue. Later, we will create the service application, and then the server will become compliant again.
N.B., if you already tried to create the service application, and it failed you will need to delete it before proceeding with the below steps.
- Start the service instance
- Firstly, check the above mentioned article to know which servers in your farm should run the required service instance.
- Secondly, you will need to know the Type Name of your service instance of your service application; whereas, below is the type names of the SharePoint service instances:
- Search Host Controller Service
- Microsoft SharePoint Insights
- App Management Service
- Managed Metadata Web Service
- Access Services
- Business Data Connectivity Service
- Request Management
- Secure Store Service
- Claims to Windows Token Service
- Microsoft SharePoint Foundation Workflow Timer Service
- PerformancePoint Service
- Microsoft SharePoint Foundation Sandboxed Code Service
- Visio Graphics Service
- SharePoint Server Search
- Document Conversions Launcher Service
- Document Conversions Load Balancer Service
- Search Query and Site Settings Service
- Microsoft SharePoint Foundation Web Application
- Central Administration
- Microsoft SharePoint Foundation Incoming E-Mail
- User Profile Service
- Access Database Service 2010
- Project Server Application Service
- Microsoft SharePoint Foundation Subscription Settings Service
- Lotus Notes Connector
- Word Automation Services
- PowerPoint Conversion Service
- Machine Translation Service
- Distributed Cache
- Once you know the servers to run the service instance on, and the type name of your service instance, run the below command via SharePoint management shell on any of your SharePoint servers.
Get-SPServiceInstance | ?{$_.TypeName -eq "ServiceTypeName" -and $_.Server.Name -eq "ServerName"} | Start-SPServiceInstance
N.B., change the above highlighted values with your service instance type name, and your server name respectively.
-
- After running the above command, run the below command and check the service instance status. It should eventually become Online. If not, you will need to investigate why it's not.
Get-SPServiceInstance | ?{$_.TypeName -eq "ServiceTypeName" -and $_.Server.Name -eq "ServerName"}
-
- After the service gets started (its status become Online), run the same above command to start the service instance on the remaining servers in the farm that are supposed to run the service instance based on their MinRoles.
Create the service application normally using the UI from the Central Administration site (Application Management >> Manage Service Applications) or by using PowerShell.
P.S., the same idea should work if you are deleting the service application and it fails with timeout. As deleting the service application will firstly stop the correspondent service instance before deleting the service application. If this is the case, stop the service instance manually on all the farm servers using SharePoint management shell (Stop-SPServiceInstance), and then delete the service application.