Showing posts with label Service Applications. Show all posts
Showing posts with label Service Applications. Show all posts

Friday, July 27, 2012

SharePoint 2013/2016: Opening the Memory Gates for Service Application Web Services

I ran into an issue this morning attempting to use some PowerShell cmdlets for the BCS service application. I received a "The requested service could not be activated" as shown here:



The requested service,
'http://sp2013:32843/4f39326869244b19af72d89efe182a87/BdcService.svc/http'
could not be activated. See the server's diagnostic trace logs for more
information.


The error message shows the URL to the BDCService so I navigated to the service in a new browser to see if I could glean anymore information:


Memory gates checking failed because the free memory (128397312 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element. ]

Since I am working on a local virtual machine that is limited in memory, apparently there is a threshold in order for the service application web services to run. The SharePoint 2013 service applications use WCF web services (by the way).

The error message here actually explains how to resolve it. All you need to do is adjust the minFreeMemoryPercentageToActivateService parameter of the serviceHostingEnvironment configuration element.

The parameter and the configuration elements do not actually exist so defaults are used. Therefore, you need to add these to the web.config of the web service you want to adjust. For me it was the BCS (or BDC) web service.

You can easily locate the web.config by going to IIS Manager and finding the web service application under SharePoint web services (the guid value was shown to me in the command console):



Right click and select Explore:



This opens up a Windows Explorer window at the location of the web service:


There's the web.config you need to modify. Open it up in Visual Studio or Notepad.


The serviceHostingEnvironment config element must be within the <system.serviceModel> section. Therefore I decided to scroll to the end of the <system.serviceModel> section and place the serviceHostingEnvironment element there, setting the minimum percentage to 1:

<serviceHostingEnvironment minFreeMemoryPercentageToActivateService="1" />

Save the changes and then refresh the web service browser instance:


Cha-Ching! We are back in business!






Tuesday, January 18, 2011

SharePoint 2010: Removing GUIDs in Several Service Application Database Names

Introduction

I noticed a few months ago that Shane Young was on a mission to explain how to remove the GUID from the default database names that are generated for each service application in SharePoint 2010. His main post which contains links to specific items is available here.

I luckily ran into several service applications that make it easy to rename the database as a new database is created and configured.

Word Automation Services
This was the first one I found. Using the SharePoint Powershell cmdlet, Set-SPWordConversionServiceApplication allows you to create a new database:

Set-SPWordConversionServiceApplication -Identity "Word Automation Services" -DatabaseServer SP2010\SQLSharePoint -DatabaseName WordServices

Managed Metadata Service
The Managed Metadata Service works the same way:

Set-SPMetadataServiceApplication –Identity “Managed Metadata Service” –DatabaseName TermStoreDB


Business Data Connectivity Service
The BCS works similiar:

$bcs = Get-SPServiceApplication -Identity bc4399ed-a2e0-4397-bf07-cd3d207e630e
Set-SPBusinessDataCatalogServiceApplication –Identity $bcs –DatabaseName BCS_DB

NOTE: You can find the GUID by using Get-SPServiceApplication and finding the BCS Service in the listing.

 

Secure Store Service
The Secure Store Service is similiar yet different. The Set-SPSecureStoreServiceApplication needs the identity of the service application, so you need to get that first:

$sss = Get-SPServiceApplication -Identity bc4399ed-a2e0-4397-bf07-cd3d207e630e
Set-SPSecureStoreServiceApplication –Identity $sss –DatabaseName SecureStoreDB

NOTE: You can find the GUID by using Get-SPServiceApplication and finding the Secure Store Service in the listing.

Here's the tricky part, although the command lines above run and take a few moments to process, the new database is not created. The new database name is set within the properties but SQL Server knows of no such thing. The easy fix here is to view the Secure Store Service Application properties from within Central Admin and click OK. Even though you may not have changed anything from the UI, the database name will be processed and a new database will be created.



Since you need to visit Central Admin anyway, you may just want to skip the PowerShell part and go right into the properties to change the name there.


Conclusion
Each service application has its own way of doing things, however, some make it easy to change the database name and actually create a new instance in SQL Server. Once the new databases are created, you can drop the old databases with the GUID. You may need to restart your servers such that the old databases are no longer in use. If you found this useful, please help support my SharePoint and .NET user group (Philly SNUG) by clicking on the logo below.

Matched Content