WCF Named Pipes and Azure Web Roles

I've spent much too long banging my head against a wall for this one.

Running Azure SDK 1.7 / Visual Studio 2010 Ultimate. I can't seem to run a WCF service over named pipes hosted by IIS/WAS. Any attempt to connect to my service in the compute emulator yields

The pipe endpoint 'net.pipe://localhost/services/MyService.svc' could not be found on your local machine

I was going to post my code, but it turns out that the sample code from this article http://blogs.msdn.com/b/tomholl/archive/2011/06/28/hosting-services-with-was-and-iis-on-windows-azure.aspx gives me the exact same error. All the code is available on that site.

As far as I can tell, the powershell tasks are executing successfully. (Well, OK, I had to change the ExecutionPolicy from Unrestricted to RemoteSigned in the startup task, but after that it ran just fine.) The NetPipeActivator service is running, and when I call Get-WebApplication I see net.pipe in the protocol list:

PS C:\> $WebRoleSite = (get-website "*webrole*").Name
PS C:\> Get-WebApplication -Site $WebRoleSite

Name             Application pool   Protocols    Physical Path
----             ----------------   ---------    -------------
WcfService1      4a16b147-f9ac-41d9 http,net.pip c:\Code\WasInAzure\WcfService1
                 -9543-0577da64fb9a e

What else could be going on?

Answers


I solved it. Phew!

My issue was that I was hosting my WCF service from within the root website, not a child application. I had to add the following line to the powershell script to enable named pipes on the main website:

Set-ItemProperty "IIS:/Sites/$WebRoleSite" -Name EnabledProtocols 'http,net.pipe'

I also ran across this error while working with this sample code. In my case, I received the error when trying to replicate the Cloud Service, but not with the original Cloud Service project in the solution.

The key difference ended up being the osFamily attribute of the ServiceConfiguration element in the ServiceConfiguration.csfg file.

In the sample, it's set to "2:"

<ServiceConfiguration serviceName="WasInAzure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="2" osVersion="*" schemaVersion="2015-04.2.6">

In the newer projects, it's set to "4:"

<ServiceConfiguration serviceName="WasInAzure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2015-04.2.6">

The change in OS breaks the PowerShell script. Here's an updated version of RoleStart.ps1, which should work on Server 2012 R2 (osFamily 4):

write-host "Begin RoleStart.ps1"
import-module WebAdministration 

# Starting the listener service 
install-windowsfeature -name AS-Named-Pipes
$listenerService = Get-WmiObject win32_service -filter "name='NetPipeActivator'"
$listenerService.ChangeStartMode("Manual")
$listenerService.StartService()

# Enable net.pipe bindings
$WebRoleSite = (Get-WebSite "*webrole*").Name
Get-WebApplication -Site $WebRoleSite | Foreach-Object { $site = "IIS:/Sites/$WebRoleSite" + $_.path; Set-ItemProperty $site -Name enabledProtocols 'http,net.pipe'}
New-ItemProperty "IIS:/Sites/$WebRoleSite" -name bindings -value @{protocol="net.pipe";bindingInformation="*"}

write-host "End RoleStart.ps1"

Summary of changes:

  • Added install-windowsfeature -name AS-NamedPipes, as the NetPipesActivator service wasn't present.

  • Updated EnabledProtocols to enabledProtocols. That one took some searching. I finally found a comment to a blog post that put me on the right path.


Need Your Help

OpenCV detecting ROI, creating submat and copy to original mat

java opencv mat roi

i'm trying to gray the faces of all people in an image. While I can detect their faces and gray them into smaller mat(s), I'm unable to 'copy' the grayed faces to the original mat. Such that the end

Excel Nesting IF in SumIfs

excel nested

Ok. So i'm looking to nest IF in my SUMIFS formulas. The only problem i'm having is when one of my referenced cells show FALSE, the formula no longer works. How do i get the formula to completely r...