Combining an HttpListener service and a Wcf service - wcf

I'm building a self-hosted service to be consumed by Silverlight. This service is not a straight Wcf service, but it uses HttpListener to implement a streaming service for Silverligt. To mkae it accessible by Silverlight, I've created another service (that is a Wcf service) to serve the clientaccesspolicy.xml file.
My problem is that once my clientaccesspolicy service is registered at http://localhost:9001 I cannot access my streaming service that is listening at http://localhost:9001/silverlightstream.
I've a couple of other Wcf services registered at http://localhost:9001/xxx which can seamlessly coexist with the clientaccesspolicy service.
What do I need to do to get the streaming service to work together with the clientaccesspolicy service?
Thanks in advance for your help.

I've answered a similar question before, I don't know how much it fits your situation, but it does look like it might help you out a little:
How can I host a Silverlight 4 application in a WPF 4 application?
In my project, I took it further and delivered the html/xap files via said self hosted service (so as not to require IIS, as IIS was a bit too much bloat for what I required).

Related

Calling a net.tcp wcf service from Silverlight - in an external facing web site?

I have an external (public) website developed in Silverlight. The Silverlight app currently calls http based wcf services hosted in IIS.
I am now having to call a wcf service with net.tcp binding hosted in a different app server. I have the net.tcp wcf service hosted in a windows service on port range 4502-4530 and with an interface to expose clientaccesspolicy.xml file as part of the service. I am able to invoke this service from my Silverlight app in the web server. I want the SL app to make direct call to net.tcp, rather than routing the call to it from another http based service.
Question is will this work without any issues when exposed over internet.
Client browser --> IIS webserver with Silverlight website --> App Server with wcf service on net.tcp.
I am assuming in this case, from XAP SL would try to make direct call to the app server service using net.tcp ?
The communication between the web server and app server could be opened up for ports 4502-4535. But I am wondering what about the client. Does this setup require the ports to be available even in the clients machine (with browser)?
Any insight is much helpful.
Thanks.
Take a look at http://support.microsoft.com/kb/2425652; there is sample code included as well! If you setup clientaccesspolicy.xml correctly; it should work as long as clients can access your TCP server.
If your clients are behind some firewall which is blocking your server's ports; they may face connectivity issues!

How to convert self-hosted WCF service to IIS 7

I currently have a self-hosted WCF service running in a Windows service. I have been asked to host the WCF service in IIS 7. It seems that all of the MSDN suggestion require me to implement a wrapper class for the service instead of loading the service dll directly via a configuration file. I have already read the links Why/how to migrate self-hosted WCF service to IIS7? and WCF Service. Can't host in IIS7. Has anybody done this before? If so, can you point me in the right direction?

RESTful WCF hosting

I have a RESTFul WCF service and it needs to be deployed now. I am really confused whether to deploy in windows service or IIS 7. I need to implement SSL also so the protocol would be HTTPS. It is just a simple service consumed by client using HTTPS protocol.
Please let me know which one is better.
Your question seems to have been asked (and answered) previously.
The following link provides a good discussion:
IIS WCF service hosting vs Windows Service
If your RESTFul WCF Service needs to be accessed via http (or https) protocol, then deploy in IIS7.

Questions about adding a WCF service to a Windows service assembly

I have found some basic information about hosting a WCF service in a Windows service, but not much. All of my experience thus far with WCF has been in Web projects. I have a few simple questions.
I have a project which creates a windows service application. I have done a right click -> add WCF Service. This creates Service1.cs and IService1.cs.
I'm wondering why no SVC file is created in this scenario? When I add services to Web projects i get an SVC file which I can navigate to and use to consume the service.
Adding the service adds some configurations to the app.config under the services element. I'm seeing a default base address of
http://localhost:8732/Design_Time_Addresses/WindowsServiceName.services/WCFServiceName/
What does this mean? It's sort of an odd looking address. Am I supposed to change it to whatever I want?
Navigating to this address in a browser results in an unable to connect message. Does the windows service itself have to be running to talk to the WCF service?
How do I go about consuming this service from another application without an svc file?
I'm taking a guess on this first one, but I'm thinking the .svc file when hosting in IIS is to tell IIS, "Hey I have a WCF service here, please handle accordingly".
The base address is as it should be and yes you can change it if I'm not mistaken.
You can't hit the WCF service unless the Windows service is running, which is one of the dangers of hosting in a Windows service, because if the service dies somehow your WCF service is offline until you get the Windows service running again.
You consume the service the same way you do any other WCF service, just using that base address to get at it.

How to host WCF Data Service (OData) in IIS7?

Does anyone know how to host a WCF Data Service (or OData) inside IIS7? I'm seeing lots of articles about hosting WCF, but none specific to WCF Data Service.
Thank you very much.
Hosting a WCF Data Service in IIS is actually the default option.
Its a pretty easy 3 step process:
Create a new WebApplication project (or re-use an existing one)
Add a WCF Data Service to the project
Deploy to your IIS server
Step 3 is just the standard process for deploying a WebApplication to IIS.
A WCF Data Service is just a WCF (REST) service, with some additional out-of-the-box functionality added in.
It has a *.svc file and all - it will be hosted very much the same as a "regular" WCF REST service.
So all the articles you see about WCF REST should really apply to WCF Data Services as well - or are you experiencing some difficulties with something specifically??