Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5962719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:08:44+00:00 2026-05-22T19:08:44+00:00

How should one configure an Azure Webrole when using a TCP-based WCF on the

  • 0

How should one configure an Azure Webrole when using a TCP-based WCF on the same ports as IIS?

An on-premise solution would typically use WAS activation, however this usually involved setting permissions on the HTTP ports etc. In Windows Azure this interface isn’t readily available.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:08:44+00:00Added an answer on May 22, 2026 at 7:08 pm

    The best way to host a WCF service in an Azure WebRole is using Windows Activation Service (WAS). Typically this is needed when you want to provide web content (HTTP) and some TCP-based WCF service on the same ports (80 or 443).

    Here is a PowerShell script that will enable the TCPPortSharing service, and configure IIS appropriately. Although this works for Azure, with slight modification you can use this for an on-premise Windows 2008 R2 server as well.

    #adding this to be sure that IISConfigurator has a chance complete
    
    Add-Content -path .\trace.txt "Starting...$([Datetime]::Now.ToString())" 
    
    Start-Sleep -s 300
    
    Add-Content -path .\trace.txt "Adding Microsoft.WindowsAzure.ServiceRuntime..."
    Add-PSSnapin Microsoft.WindowsAzure.ServiceRuntime
    while (!$?)
    {
        Add-Content -path .\trace.txt "Failed to add Microsoft.WindowsAzure.ServiceRuntime, retrying after five seconds..."
        sleep 5
    
        Add-PSSnapin Microsoft.WindowsAzure.ServiceRuntime
    }
    
    Add-Content -path .\trace.txt "...done adding Microsoft.WindowsAzure.ServiceRuntime $([Datetime]::Now.ToString())"
    
    #Start the Net.TCP Port Sharing and Net.Tcp Listener Adaptor services.. (TODO:Not sure if we need to set this to auto)
    
    Add-Content -path .\trace.txt "Setting NetTcpPortSharing & NetTcpActivator service startup to auto... $([Datetime]::Now.ToString())"
    
    Set-Service NetTcpPortSharing -StartupType Automatic
    Set-Service NetTcpActivator -StartupType Automatic
    
    Add-Content -path .\trace.txt "...done Setting NetTcpPortSharing & NetTcpActivator service startup to auto ... $([Datetime]::Now.ToString())"
    
    Add-Content -path .\trace.txt "Starting NetTcpPortSharing & NetTcpActivator services ... $([Datetime]::Now.ToString())"
    
    Start-Service -name NetTcpPortSharing
    Start-Service -name NetTcpActivator
    
    Add-Content -path .\trace.txt "... done Starting NetTcpPortSharing & NetTcpActivator services $([Datetime]::Now.ToString())"
    
    #Get the Role Instance Id
    
    Add-Content -path .\trace.txt "Getting the RoleInstance ID... $([Datetime]::Now.ToString())"
    
    $roleInstance = Get-RoleInstance -current
    $roleInstanceId = $roleInstance.Id
    
    $siteName = '_Web'  #This is the site name from the <Site> tag in ServiceDefinition.csdef
    
    Add-Content -path .\trace.txt "Instance ID : $roleInstanceId"
    
    Add-Content -path .\trace.txt "... done Getting the RoleInstance ID $([Datetime]::Now.ToString())"
    
    #Create the bindingCmd
    
    #Add-Content -path .\trace.txt "Building commands ..."
    
    #$addBindingCmd =  "set site `"" + $roleInstanceId + "_" + $siteName + "`" -+bindings.[protocol='net.tcp',bindingInformation='808:*']"
    #$enableNetTcpCmd =  "set app `"" + $roleInstanceId + "_" + $siteName + "`" /enabledProtocols:http,net.tcp"
    
    Add-Content -path .\trace.txt -value $addBindingCmd
    Add-Content -path .\trace.txt -value $enableNetTcpCmd
    Add-Content -path .\trace.txt -value "...done Building commands"
    
    set-alias appCmd $env:windir\system32\inetsrv\appcmd.exe
    
    Add-Content -path .\trace.txt -value "Adding Net.Tcp binding... $([Datetime]::Now.ToString())"
    
    #add the binding..
    #appCmd $addBindingCmd 
    
    appCmd set site `"$roleInstanceId$siteName`" /debug -+"bindings.[protocol='net.tcp',bindingInformation='808:*']" >>trace.txt
    
    Add-Content -path .\trace.txt -value "done Adding Net.Tcp binding"
    
    Add-Content -path .\trace.txt -value "Enable Net.Tcp... $([Datetime]::Now.ToString())"
    #appCmd $enableNetTcpCmd
    appCmd set app "$roleInstanceId$siteName/" /debug /enabledProtocols:"http,net.tcp" >> trace.txt
    Add-Content -path .\trace.txt -value "done Enable Net.Tcp"
    
    Add-Content -path .\trace.txt -value "End $([Datetime]::Now.ToString())"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How much should one DataSet represent? Using the example of an ordering system: While
Should one create unit tests involving IO? Ie, testing a class method for serializing/deserializing
Where should one go to be kept updated on all of the security flaws/problems
When should one use a scripting language over a more verbose, compiled language like
How should one ensure correctness when multiple processes access one single SQLite database file?
How should one split up the controllers in an ASP.NET MVC site? For example,
Why should one go for Windows Installer XML (WiX) when we have in built
In what situations should one catch java.lang.Error on an application?
What return type should one return from a method that is getting rows from
when overriding the loadView method in UIViewController, should one call [super loadView] in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.