Do you have to restart IIS when re-deploying a WCF servic? - wcf

Assuming that the service is running and in use, and you didn't change the contract or anything - just some underlying logic. After publishing the service to IIS, do you have to restart IIS?
(If it matters, the InstanceContextMode is Single)
Are there any instances where you would/would not need to?

No. You don't need to restart IIS. What will happen is that ASP.NET will notice that the files have been modified and the AppDomain will be reloaded. If you have other web sites hosted on IIS - they won't be affected at all.
It is still recommended that you use a separate app pool for each web site.

Related

WCF service streaming - Console host vs. IIS host

I've created a streamed wcf service based on that example: http://www.codeproject.com/Articles/112655/Progress-Streamed-File-download-and-Upload-with-Re
With console host works everything fine, the upload and the writing run "parallel". But if I host the service in IIS, it seems, that the stream is buffered on the server side.
Why? What is the difference? Is the service with console host not reliable?! (I need reliable streming!)
How can I avoid that with IIS host?
How do you know its buffered? Check the config file on the client side after proxy generation. Sometimes the proxy generated config file has incorrect transfermode.
When you start writing the file on the client, don't any see any chunk wise increase in the size of file?
The hosting shouldn't affect the transfermode.
The only difference between IIS and Console would be the way activation/deactivation is managed.
I've found it: Getting Streaming in IIS Hosted WCF service to work
I think this is a known issue (streaming with .net 4.0 and iis 7).
When a WCF service using streaming is hosted in IIS then ASP.net
buffers the request at its layer. The request does not even come up to
WCF until ASP.Net is done with it.
This should work when using non-HTTP transport IIS or hosting in a
non-IIS host.
(Zulfiqar Ahmed)
on contacting the product team - they said it would be fixed in .NET
4.5 as its too big to be issued as a patch.
And it works with .NET Framework 4.5

IIS Hosted WCF Service with TCP endpoint stops after Application Pool Recycle

I have an IIS application which hosts a TCP WCF service in Global.asax. I use that service to make interrole communications between my roles in Windows Azure. The problem is WCF services stops working after application pool recycles(29 Hours). After that, my interrole requests starts to fail.
How can I control recycle event to keep my webroles alive. What is the best solution to do it?
I tried auto-start feature but it didn't work.
You should install and use Appfabric with iis7.0 It has an auto start feature that is configurable
http://msdn.microsoft.com/en-us/library/ee677312(v=azure.10).aspx

Migrate WCF service from IIS to self host. How and should I?

I'm currently hosting a WCF service on an IIS 7.5.
Problem is I need to save data for the duration of the session (using static members) but the AppPool recycle keeps deleting all the cached data.
For my understanding my only solution is to self host the service.
I have no clue on how to do that and what are the pros and cons.
is this really my only option?
UPDATE
Looks like there was a different problem.
I changed hosting from IIS to self-hosting on a console application and I found a bug that was crashing the app. I'm guessing this was the reason for the loss of data and not the app pool recycling...
That does not seem like a good reason to migrate from IIS to Windows service . why not to disable app Pool recycling by
Idle Time-out(minutes) = 0
"Regular time Interval(minutes)" = 0
so it will never recycle
Also
Disable Recycling for configuration Changes = true
these settings live in advanced settings of AppPool
Update: how about
"Disable Overlapped Recycle" = true
AppPool Recycle settings
If this is the problem, I think you are storing the cache in memory. We can store the store the cache in disk,database or any your customized location. so there is no need move your application from IIS to self-host.
http://weblogs.asp.net/scottgu/archive/2010/01/27/extensible-output-caching-with-asp-net-4-vs-2010-and-net-4-0-series.aspx

Restart a WCF service after a server reboot

Is there some mechanism in WCF that can be used to "pre-start / warm-up" WCF services that are hosted in IIS ?
- something like the warm-up scripts for SharePoint sites
I have the situation where servers are re-booted over night and next day there is a long delay while the WCF services spin-up. I can't change the time-out in various applications that use the services, so the first users are reporting errors in the morning when they go to use their applications
This is on Windows 2003 Server and IIS 6.0, so the IIS Application Pool Warm-Up Module, http://www.iis.net/download/applicationwarmup, as that's for IIS 7.5
NOTE: the module seems to have been temporarily withdrawn, see details on ... IIS Forum
I know you will don't like the answer and I think I repeat myself because it is not the first time I'm posting it. The way to warm-up anything in IIS prior to version 7.5 is using scheduled console application to ping your web site / services and warm them up. It is ugly solution but it works, it is easy and I saw it on every project which had to deal with this requirement.
WCF services should be instantly ready when they start. Just make sure the services are set to automatically start when the server boots.
You can use Windows Server AppFabric, it has Auto Stat feature to keep the service always on. But you need to be on IIS 7.5 to install App Fabric.

How can I use net.tcp without IIS?

I have a web site and build a wcf service in it. I can run the code by calling it from a test page in the web site. The web site is ran by the vs2010 development server.
I do have IIS 7 but never use it.
Now I want to use the NetTcpBinding instead of BasicHttpBinding, everyone says it should be enabled in IIS, but how can this be done without using IIS and keeping everything in 1 project?
Thanks for any help
edit: A Windows service would be a solution, but that would mean adding a project to the solution, I really want to keep everything in 1 website, took me quite some time to get the service in the website in the first place.
This is about my own test version of the website, the production server is out of my reach. The service must be expanded by other developers later on it's bad if they have to run IIS just to test the service.
One way is to host the WCF service in a Windows Service - see How to: Host WCF in a Windows Service Using TCP for sample code.
Are you talking about how to develop without using IIS7 or how to put the service into a production environment without IIS7?
If it's the latter, then Stuart's answer is correct, but otherwise I would suggest that you start to develop using the web server that you will eventually be hosting the web site/service on.
Hosting in IIS7 has several advantages over hosting in a Windows Service such as fault tolerance and process isolation already built in.
Thanks for the replies guys, it looks like I have 3 options:
1. Host the service in a seperate project.
2. Host the website in IIS.
3. Use HTTPS, also secure.
PS: My development environment is very different from production :(
In development I have unit testing and in production there are old ASP pages, that I can't even acces, but sometimes must refer to...