Tag: Microsoft Developer Network

Bing Code Search for C# – Visual Studio Extension

[ Visual Studio blog postTry it out Online ]

The Bing Code Search add-in for Visual Studio 2013 makes it easier for .NET developers to search for and reuse code samples from across the coding community, including MSDN, StackOverflow, Dotnetperls and CSharp411.

Bing Code Search improves developer productivity and speed by bringing the experience of searching for reusable C# code into Visual Studio IDE.

Check out this demo video for more info

 

bingcodesearch2

Creating SharePoint 2013 Apps – Set the App Domain

To get going with developing SharePoint 2013 apps, you need to first set up an App Domain. I first installed SharePoint 2013, then Visual Studio 2012 RC, then ran the web install to get the SharePoint 2013 development extensions added in. You then fire up Visual Studio, saw the new “Apps” entry in the Office/SharePoint templates for Visual Studio, and created a new project based on the “App for SharePoint 2013” project type.

When you attempt to deploy your app, SharePoint comes back with the error “Failed to install App for SharePoint” in Visual Studio’s Error list. The Output window didn’t show much more than that. When you look in the ULS log for the App’s project name, you get this message:

An App domain must be configured prior to completing this operation

The issue is: before creating an App for on-premise hosting, you need to configure a hosting ‘domain’ for your Apps.

The following MSDN article indicates the PowerShell required to get that sucker wired up:
http://msdn.microsoft.com/en-us/library/fp179923(v=office.15)

However.. Tod Klindt’s post Using PowerShell to Set Up Your App Domain in SharePoint 2013 has a slightly sexier, one-shot one-kill version of the PowerShell steps required:

# Assumes you have a Service App Pool named "Default SharePoint Service App Pool"
$apppool = Get-SPServiceApplicationPool "Default SharePoint Service App Pool"
$appname = "App Management Service"

$dbname = "AppManagement_DB"
# Create the App Management service and start its service instance
$sa = New-SPAppManagementServiceApplication -ApplicationPool $apppool -Name $appname -DatabaseName $dbname 
New-SPAppManagementServiceApplicationProxy -ServiceApplication $sa -Name "$appname Proxy"
Get-SPServiceInstance | Where-Object { $_.typename -eq "App Management Service" } | Start-SPServiceInstance

# Create the Subscription Settings service and start its service instance
$sa = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $appPool -Name "Subscription Settings Service" -DatabaseName "Subscription_Settings_Service_DB"
New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $sa
Get-SPServiceInstance | where{$_.TypeName -eq "Microsoft SharePoint Foundation Subscription Settings Service"} | Start-SPServiceInstance
# Configure your app domain and location
# assumes path of app.contoso-apps.com
Set-spappdomain -appdomain "contoso-apps.com"
Set-spappSiteSubscriptionName -Name "app"

Interestingly, I ran into the following error on the last step Set-SPAppSiteSubscriptionName -Name “app” -Confirm:$false

Set-spappSiteSubscriptionName : The requested service, ‘http://localhost:32843/ SecurityTokenServiceApplication/securitytoken.svc/actas’ could not be
activated. See the server’s diagnostic trace logs for more information. At line:1 char:1 + Set-spappSiteSubscriptionName -Name “app”+

Note that the name isn’t the same name given in the set-spappdomain step – the above didn’t like the period separator in my app.mydomain.com, so I used just the leftmost subdomain part of my domain.

The error, though, was another surprisingly clear error message. It could be traced to the following error in the Servers Manager > Local Server > Events:

WebHost failed to process a request.
 Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/9051906
 Exception: System.ServiceModel.ServiceActivationException: The service '/879afece63b54f95a16f9c9c110b0a24/ProfilePropertyService.svc' cannot be activated due to an exception during compilation.  The exception message is: Memory gates checking failed because the free memory (99291136 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.. ---> System.InsufficientMemoryException: Memory gates checking failed because the free memory (99291136 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.
   at System.ServiceModel.Activation.ServiceMemoryGates.Check(Int32 minFreeMemoryPercentage, Boolean throwOnLowMemory, UInt64& availableMemoryBytes)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CheckMemoryCloseIdleServices(EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   --- End of inner exception stack trace ---
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)
 Process Name: w3wp
 Process ID: 6100

The solution: 8GB RAM did not seem to be enough for this hungry hungry hippo. When I added more RAM (went to 14GB RAM as that’s what was available at the moment), things worked as expected. The Microsoft SharePoint Foundation Subscription Services Application now appears in our Service Applications list:

MSDN Quick Links

The MSDN Library homepage has a newish “beta” quick links section which is a great index for navigating in an easier way than the somewhat dense tree nav: