I am trying to host a WCF service with a net.tcp binding in IIS in Azure according this article http://blogs.msdn.com/b/tomholl/archive/2011/06/28/hosting-services-with-was-and-iis-on-windows-azure.aspx. But it has not any effect.
I try to do the folowing: Create CloudService Create WCF web-role In web-role project create folder Startup and place two files there: Startup.cmd
powershell -command "set-executionpolicy Unrestricted" >> out.txt
RoleStart.ps1
import-module WebAdministration
# Starting the listener service
$listenerService = Get-WmiObject win32_service -filter "name='NetTcpActivator'"
$listenerService.ChangeStartMode("Manual")
$listenerService.StartService()
$listenerService = Get-WmiObject win32_service -filter "name='NetTcpPortSharing'"
$listenerService.ChangeStartMode("Manual")
$listenerService.StartService()
$WebRoleSite = (Get-WebSite "*webrole*").Name
Get-WebApplication -Site $WebRoleSite | Foreach-Object { $site = "IIS:/Sites/$WebRoleSite" + $_.path; Set-ItemProperty $site -Name EnabledProtocols 'http,net.tcp'}
New-ItemProperty "IIS:/Sites/$WebRoleSite" -name bindings -value @{protocol="net.tcp";bindingInformation="808:*"}
I also added net.tcp endpoint to Role properties with port 808.
First fail when i try to publish - role cyclic starts and stops. But when I disable Startup.cmd, it publishes successfully.
But even in this case, I can't resolve service reference.
What I must to do that this service will work?
Make sure that in your Service Definition file that your executionContext is set to 'elevated'. See this MSDN post for more details on the options available.