WCF self hosting and IIS - c#

Does WCF self hosting, still uses IIS or some Virtual Server based on IIS.
Eg: After coding a very basic WCF host, it s possible to invoke an endpoint such as
http://localhost:9090/foo.svc
For example: invoking a WCF host via TCP, does that use IIS internally?
I m trying to avoid IIS due to another app i m using, which doenst work with IIS Threads. That s why asking. so i d like to manage my own AppDomain and threadpool rather than IIS.
Any recommendation?
Can i seperate hosting of WCF from IIS?

When you self-host, you are using not a shred of IIS at all. You don't need IIS on that machine - nothing.
WCF self-hosting will require the http.sys driver for its http-based communication - but that's all there is. There is absolutely no trace of IIS needed - none, zip, nada.
Self-hosting WCF also allows you to pick your own service addresses and use whatever suits your needs - there's no virtual directory and no *.svc file to be dealt with.

It depends on the bindings. if you do a BasicHttpBinding, then all the communication will be over HTTP.
As for hosting WCF, there is the test server that comes with Visual Studio that you can use (it runs as a service. It's called WcfSvcHost.exe), but I wouldn't recommend it for production. If you are just testing, then you could just launch the WCF in the Visual Studio debugger and use its address all you want (it will be http://localhost:1234/foo.svc in that case)
If you are looking for a production hosting, you can use WCF as a SOAP endpoint, and here there is a pretty good article over at The Code Project that talks about creating a service for self hosting

Related

WCF self hosting or IIS hosting - which is better from performance perspective

I'm trying to create a web service that serve around 100 client, include file uploading. Fast respond is a requirement. For such kind of scenario I usually create a WCF web service and hosted in IIS with BasicHttpBinding. It works, but is there a "better" way to archive the same thing? Thanks!
I've looked building a WCF with web socket and host it at server as a window service, but it seems a little complicate:\

How to host a WCF service

I am trying to create a chat application in WCF.
I've created the client and the service on a localhost using httpBinding,
this is the service endpoint:
http://localhost:9999/ProductService
Now, I really don't know how to make the program run 'globaly' and not on a localhost.
Is there anyway to host the server on my pc? or run the application serverless using p2p communications?
Thanks anyway for your Time
You can set up at publicly accessible web server on your own computer, but it's definitely not recommended for any production purposes, unless you have a good understanding of this and have a internet-connection that allows for it, both technically and legally.
You should probably get external web hosting for this instead.
But if you really want to do this, you can install IIS to host the service.
As a side note, I don't think WCF is the optimal route to take for this anymore. Maybee you should check out SignalR and/or WebSockets instead. And ASP.NET Core WebAPI. It's not really anything wrong with WCF, but for new projects I wouldn't recommend it.

How to create a secured/private WCF service

I want to create a WCF service that may be accessed only on localhost.
I couldn't find any reference for that, is that possible?
All the posts I had found talked about this scenario as a bug, well I'd like it as a feature.
Any ideas?
If you're flexible on protocols, you could use a netNamedPipeBinding hosted in a Windows service.
You can configure the binding for the web site it is attached to and change it to localhost, rather than *. If you are hosting other services that need external access you can always create a new web site on a different port, such as localhost:8000.
A WCF service should be agnostic about how it's hosted or accessed.
Whatever's hosting the service, on the other hand, determines how the service can be accessed.
As Mike Goodwin suggested, having your host only allow netNamedPipeBinding will restrict the service to only be accessible via the machine that the host is running on.
Here's an article on the various transport protocols, including named pipes.
Here's a pretty in depth article on hosting WCF services.

2.0 Web Service Proxy to WCF Service

We have a 2.0 Web Service proxy generated for a WCF Service. This service required Basic authentication, but periodically we experience problems that the proxy cannot connect to the Server.
The application is installed on a cluster and referencing a cluster that holds the WCF Service.
Anyone experience this problem already?
Could be that the service is only installed / working on one server in the cluster. Therefore, sometimes it works and sometimes it does not, depending on which machine you hit.
Apparantly it has to do with the setup of the environment. All the machines are virtual and the errors occurs depending on the host they are running on. I also was able to reproduce it with the WCF Proxy as well by switching on/off VM's.
thanks for the answers
You may want to consider deploying an ASMX service backed by the WCF service class. This gives you a classic XML webservices facade to work with.

how to create a c# app to listen for xmls and reply in xml

I know that you can create web services in .net and have them run on iis. I'd like to make something that doesn't rely on iis as the webserver I'm using runs apache.
The eventual app should listen for incoming xml documents and repy in the form of an xml document, the client application will be running Javascript and sending xmls via http post requests. Is this something that SOAP handles?
All the guides and tutorials seem to follow the microsoft way, all hosted on servers running iis... is there a way around this?
As you can tell I'm quite confused as how to start.
I would strongly advise against implementing your own web service hosting platform - this really isn't a trivial thing to implement, especially if you want to be passing proper web service messages between your servers.
One option that would allow you to utilize WCF and Microsoft's baked in web service functionality is hosting WCF as a standalone service. In this model, you aren't using IIS to host the web service - you trade off some monitoring and logging functionality baked into IIS but it doesn't require IIS be installed.
Here's an article on WCF hosting options - http://msdn.microsoft.com/en-us/library/bb332338.aspx

Categories