SharePoint — First Approach to Dev Configuration

I’m writing this post because I’ve noticed there’s not clear documentation about how to configure Sharepoint correctly for development. I’m in a project where I have to develop a Sharepoint App and I’d like to share (and document) how to configure a brand-new Sharepoint that supports debugging of new apps from Visual Studio.

I’m not going to go deep into Sharepoint Technology this time, but if you’re interested, take a look at this link.

The goal:

Configure a brand new Sharepoint 2013 server installation to be able to debug apps made in Visual Studio 2015.

What I have so far:

A brand new Sharepoint 2013, installed on Windows Server 2012 R2, running as a VMWare machine. I already ran the wizard and the management site was created at port 40000. And I’ve also created a Web Application at port 80 and a site collection there.

A small Visual Studio app that I want to debug in Sharepoint (to know how to make one, refer to this link.

When I try to run the VS app for the first time, appears the first “error”: “Sharepoint sideloading of apps is not enabled on this site”. Following security’s standards of Microsoft products (as secure as possible from the box) many of the development features on Sharepoint are disabled by default. Solution: open a Sharepoint Management Powershell Console and write: Enable-SPFeature e374875e-06b6–11e0-b0fa-57f5dfd72085 –url <your site url>. This command is not very funny: once you’ve ran it, there’s no message telling that the operation was successful or not… it just run.

After this, I tried again to run my VS app on Sharepoint. The sideloading error is gone but now there is an “Internal Server error (500)”. Very self-explanatory, I decided to take a look at the server’s event logger, and that’s what I found:

WebHost failed to process a request.

Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/6943758

Exception: System.ServiceModel.ServiceActivationException: The service ‘/_vti_bin/client.svc’ cannot be activated due to an exception during compilation. The exception message is: Memory gates checking failed because the free memory (96956416 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.

Looks like I was a bit greedy about server’s memory. 2 Gigs are not enough. I stopped it, give 1GB more and start again.

New try to run the app. Guess what, something else is missing. The following error appears:

Error occurred in deployment step ‘Install app for SharePoint’: App Management Shared Service Proxy is not installed.

A quick search gives me the clue how to add that service in Sharepoint:

Go to Central Administration -> Manage Service Applications (Application Management section) -> Create an App Management Service. S+TF}

- Add a pair of names (for the service and the app pool where the management service will run), left the other things configured by default, and create the app. In my case I named it DeployApps.

The Management Service App and Proxy is quickly created and shown as follows:

Now test again, let see what happened. I hit F5 and…

Error occurred in deployment step ‘Install app for SharePoint’: There are no addresses available for this application.

Another quick search… and here’s the problem: the SharePoint Foundation Subscription Settings Service is missing along with its proxy.

To install it, you have to run the following script:

$account = Get-SPManagedAccount <your admin managed account>

$appPool = New-SPServiceApplicationPool -Name <name_of_your_choice> -Account $account

$serviceApp = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $appPool -name “Subscription Settings Service Application” -DatabaseName “<choose a db name>”

$serviceAppProxy = New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $serviceApp

After this is installed, assign an app url to the server. To do this go to Central Administration->Apps->Configure App Urls: I’ve configured it as follows:

(The red message is because of the dummy name: write a valid URL there and that message is gone).

Now try again: same issue. I restarted IIS. Same error! What’s happening? Let’s check some things in IIS:

- Check IIS: reset and running

- Check sites: all started.

Check Sharepoint App Pools: all runn… wait! Check this:

Looks like this service is not configured to start by default. Go to Advanced Properties, change Start Automatically to true and Start Mode to Always Running, apply and start the app pool.

Again, restart IIS (using IIS Manager or iisreset), check that all the services are up and running and try run the app from Visual Studio again:

Voila! The app is up and running!

Hope this series of steps helps anyone to speed up his first Sharepoint dev experience! i-them

By: Agustín

Like what you read? Give Diveria a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.