Unable to host a Service Bus WCF Host in IIS on Azure - wcf

I have worker roles that send out multicast messages using the azure service bus. Two of the consumers of these messages are websites hosted on Azure. I know that there are issues hosting service bus WCF endpoints in IIS even when running on premise. I've followed the Microsoft's advice and configured a service host programmatically.
One of the websites has been using this technique successfully for quite a while. It uses the hosted web core (it was developed before full IIS was an option on Azure) and it initialises the service host as part of the RoleEntryPoint.OnRun(). I'm trying to move this site to using full IIS. Because in full IIS the RoleEntryPoint runs in a different process to the site itself and the service host needs access to some static variables in the site I've moved the initialisation of the service host to the Global.asax Application_OnStart. This code works fine when running as a website under IIS locally and it runs fine when running in the compute emulator, but once I deploy it to the cloud my WCF host never seems to receive any messages. I haven't been able to catch any errors that are occurring.
Has anyone else out there successfully deployed something like this?

Related

How do you create a net.tcp endpoint to an Azure Cloud Service?

This has to be a pretty simple task. I have an Azure Cloud Service that works just fine with HTTP and HTTPS. Now I want to create a net.tcp connection to the cloud service. The first thing I discover is that net.tcp is not supported by IIS Express. That's fine. So I try switching to regular IIS and all I get when I try to run the application is a 404 error. If I was building an WCF Web Application, I would get a form that allows me to select (and build) the virtual directory for the application, but there's no analog for this in the Cloud Service.
I can take a fresh 'Cloud Service' project build using visual studio, make no changes to it except change IIS Express to IIS. When I launch it, I get a 404 error in the web browser.
Does anyone have a working example of tcp.net (with IIS Express or standard IIS) in a Cloud Service?
This video by the Azure team is a great overview and cleared up a lot of conceptual issues I had. An Azure Cloud Service is a container around one or more virtual machines. The virtual machines basically come in two flavors: Web Role and Worker Role. What threw me is the description that the Worker Role was intended for background processes: not true. A Web Role is basically a VM with IIS, a Worker Role is basically a VM without IIS. Since the off-the-shelf IIS doesn't have net.tcp installed, you have to jump through hoops in order to get the protocol installed. Instead, the Worker Role can be used as a self-hosted web service. If you want the performance and throughput of TCP, this appears to be the direction to go.

How to host wcf server on application ?

I know how to make wcf service server to run on iis.
But i need to host my wcf server on something like iis but the service will be available only when my application is up and running.
I know that it is possible to create application that will act like a wcf host.
But in this case i will not have the access from other machine ( right ? ) to this service because as far as i know .. the access to this service from other machine can be done only when the wcf service is running from iis.
Any help please ...
10x
Hosting WCF service has three different types:
Hosting in IIS
Hosting in Managed Application
Hosting in Windows Service
But in this case I will not have the access from other machine ( right
? ) to this service because as far as I know .. the access to this
service from other machine can be done only when the WCF service is
running from IIS.
If you thought that only the WCF service hosted in IIS is accessible outside that machine where service is hosted. You are completely wrong. As long as your service is up and running and your machine has Public IP address you can access it every where.

wcf service on windows 2003 server - works as server but not as a consumer/client

It is a very simple wcf service. Since my original wcf service didn't work there I decided to create one test service. Basically I'm using the default method GetData(int).
I hosted this service on windows 2003 server. It works well when I consume it from a different machine. I use a windows forms test application to consume this service. When I run this forms app on the same ws2003 server and attempt to consume the service on the same server it throws the following error:
There was no endpoint listening at http://...
I created another wcf client using asp.net, also silverlight, nothing works.
Basically, it looks like it can't consume any wcf service.
I couldn't figure out what could be the issue.
Basically, the machine had McAfee antivirus installed and was blocking http communication to aspnet_wp.exe.
The full path is c:\windows\microsoft.net\framework\v4.0.30319\aspnet_wp.exe
Everything works fine after unblocking this specific exe.

Host WCF service with net.tcp binding through IIS Manager 7.5

I am fairly new to hosting web applications and web services. Though I was successful in hosting a web application, I am running into road block after road block when trying to host a WCF service with net.tcp binding.
My scenario is as follows, I have a hosted web application that needs to communicate with a hosted WCF service with net.tcp binding through IIS 7.5. As stated the web application is hosted fine and I can browse the web site. However, the web application makes services calls to the WCF service and I am getting the 'TCP error code 10061' message which I believe is due to my hosted WCF service not running. I think this is not running because I attempt to 'telnet localhost 808' to see if the WCF service is running and it is not. I've run through numerous online guides and I still have had no luck. I believe I may be doing something fundamentally wrong with me being a noob and all. I am able to host the service through VS2010 and run the web application and it works fine so I believe my bindings are correct. I've also enabled tcp protocols on both websites in IIS Manager.
So I guess my real question is what are the IIS Manager steps needed to host a WCF service with net.tcp binding? It appears to me that it is not possible to host a net.tcp service through IIS Manager by simply creating a website because IIS Manager wants to bind to an http port.
Here are some things to check:
Ensure the Net.Tcp Listener Adapter windows service is running
Ensure netTcp is listed as an enabled protocol for your website (In IIS Manager, go to Advanced settings for your site)
Ensure netTcp is listed as an enabled protocol for application (directory) that is hosting your services (In IIS Manager, go to the directory hosting your services and select Advanced Settings)
Ensure your IIS site has a binding for net.tcp, with the correct port number listed.
EDIT:
See the following MSDN page for enabling/using non-HTTP bindings in .Net 4 + IIS 7/7.5:
Configuring the Windows Process Activation Service for Use with Windows Communication Foundation
And I discovered that for me it didn't work to use localhost... You should use 127.0.0.1 or the name of your computer.

Can I host a WCF service with NetMsmqBinding in root "/" application of an IIS7 site?

I have created a WCF service with NetMsmqBinding, and hosted it in IIS7 using Windows Activation Service (WAS).
Current (works perfectly):
Hosted in IIS at: http://localhost/MyService/MyService.svc
With the service endpoint address: http://localhost/private/MyService/MyService.svc
And the corresponding queue: .\private$\MyService/MyService.svc
Desired (does nothing, not even an error message):
Hosted in IIS at: http://localhost/MyService.svc
With the service endpoint address: http://localhost/private/MyService.svc
And the corresponding queue: .\private$\MyService.svc
Everything works perfectly when I use the MyService IIS application. But the same setup (code, IIS security, queue security, etc.) does nothing when I try to use the root "/" app instead of the "MyService" app to host the service. I don't get any errors in the Event Log. The incoming messages just sit in the queue.
Is hosting a WAS-activated service supported in in the root application of an IIS7 site?
I found a bug whereby hosting WCF services in the root (spent a lot of time on the phone with MSFT Support), thus host them in an application.
For example, I have a netMsmqBinding service hosted in IIS7, it is configured for WAS and it is hosted in the default site as:
http://mymachine/msmqtest/service.svc
The queue name for MSMQ needs to be called:
"msmqtest/service.svc"
And the endpoint in the config needs to be:
net.msmq://mymachine/private/msmqtest/service.svc
Also, make sure you are using the machine name in the config, NOT a host header name or something. MSMQ works from computer to computer, very important.
Hosting of WAS Activated Services do work rooted. I'm not 100% sure about the netMsmqBinding. the end point would need to be http://localhost/service.svc not /private though.