I have WCF service that has http and net.tcp endpoints. I have deployed the service to IIS 7.5 (Server 2008R2), everything is working good.
My question is this, is there a way to set enabled protocols for the IIS application through Web.config?? Right now I have to go to the Application in IIS and manually change the Advanced settings and add net.tcp to the list of available protocols before the service can be activated, see pic for the screenshot.
No, this setting isn't available via web.config. It can be set either via the IIS Manager as you're doing, or via the AppCmd.exe command-line utility, as in the example below:
%windir%\system32\inetsrv\appcmd.exe set app "Default Web Site/FirstWcfHost" /enabledProtocols:http,net.tcp
No, this is not a web-scoped setting. It is web application (app pool) scoped one, so it is in the applicationHost.config file.
Related
I create a WCF service in Visual Studio 2013 and publish it to IIS. I can the add a service reference in another project and consume methods on the service. When I go to the IIS Server Manager I see WCF Activation and its two sub-items (HTTP Activation and Non-HTTP Activation) unchecked.
What are these features and how does my WCF site work without them enabled? I've looked around the web quite a bit and haven't found any definitive answers. Thanks.
Before IIS 7.0 you could only host HTTP services on IIS. If you wanted to use non-HTTP protocols (e.g. net.tcp) you had to self-host. Microsoft introduced the Windows Process Activation Service (WAS) to allow common hosting within IIS regardless of the communications protocol being used.
In practical terms, one of the neat features of this is that you can host your net.tcp WCF services on IIS and they will be dynamically activated once traffic starts arriving. Previously you had to have your service running (console app, Windows Service or whatever) before messages began arriving.
Further details can be found in this MSDN article.
If you are just running WCF services using the HTTP protocol and have those services hosted in a IIS web site, the default configuration will just work.
I've created a WCF service, configured it in it web.config.
What do people mean when you also have to configure the "client"? I don't get that, is that another web.config or app.config somewhere?
http://blogs.msdn.com/b/ukadc/archive/2010/04/22/setting-up-wcf-with-a-load-balancer-using-ssl-in-the-middle.aspx "Setting up WCF with a load balancer using SSL in the middle"
The client has to have a binding and endpoint where it connects to. Your client is configured, either in app_ or web.config, or you can configure it in code behind.
If your WCF service exposes an endpoint "X" on binding (basicHttpbinding), your client needs to be configured to connect to service "X" using basicHttpbinding.
If you use the "Add Service Reference" option in visual studio, and provide your service address, I.e. http://xx.xx.xx.xx/serviceEndpointAddress , visual studio will look at it, and build the necessary binding and config for you.
i know it's been asked, but i want to clear things out, what is the difference between WCF service application and wcf service library, and how can i connect them to other machine?
is Wcf SA need to host on IIS? or is it the SL?
A service application includes a website host already setup for you. A service library is a library of services that a host can reference and startup.
If you start with a service library (recommended) you can then choose any host you wish (a windows service, IIS/ASP.NET, or even a console application) and you'd just reference your library from your new host. Choosing a Service Application limits your host to just IIS/ASP.NET (though this might be ok for your purposes, but will limit the protocols you can use).
Is it possible to enable HTTP components for WCF without installing IIS. When i try to enable the HTTP components on windows server 2008 it forces me to enable the web server components.
Is there a workaround by not installing webserver.
(any solution other than self hosting or windows service)
thanks
Ben
WCF services can be hosted in any managed .NET application, not only IIS. You can either host it inside a windows service, or create a standard .NET executable to host the service (self-hosting). You can configure your end point to http eventhough the WCF is hosted outside IIS.
Check this article for more insight:
Hosting and Consuming WCF Services
I've installed HTTP Activation and Non-HTTP Activation IIS's features for Framework.NET 3.0 under WCF Activation feature.
I'm trying to remove http and https bindings (under default Web Site) from IIS Manager and leave others (net.tcp, net.msmq, etc.) but if I close and re-open IIS manager I not found any icons in the right panel (Feature View). The only feature I see is IIS Manager Permissions.
It's right I don't see them?
I hope you can help me.
Thank you in advance!
Actually if you only use non HTTP activation, you don't need IIS Manager any more. IIS Manager is designed for HTTP web sites and FTP sites.