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 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:
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:
The requested service,
'http://sp2013:32843/4f39326869244b19af72d89efe182a87/BdcService.svc/http'
could not be activated. See the server's diagnostic trace logs for more
information.
'http://sp2013:32843/4f39326869244b19af72d89efe182a87/BdcService.svc/http'
could not be activated. See the server's diagnostic trace logs for more
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!
Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog for more soon.
ReplyDeleteThanks Roger!
ReplyDeleteGod, I couldn't find the solution until now.
ReplyDeleteThanks a lot... really... T_T
Thanks so much!
ReplyDeleteThanks
ReplyDeleteThis is good info. However, as a basic troubleshooting step, you should go to your server and see if anything is taking the memory unnecessarily. For example, if there is some process running that is causing it, it would be better to interrogate that process instead of changing a default configuration.
ReplyDelete