Can a WCF service.config file be changed on the fly? - wcf

Its a newbie question, and I have just been learning WCF.
Can we change the service.config file of a WCF service on the fly without restarting the App Pool or doing the deployment?
Regards,
Bhavik

No, IIS will automatically detect the change to the config file and recycle the app pool automatically for you. So in a sense, the app pool does have to be recycled, but it handles it for you.

If you're hosting your services in IIS and you change the web.config file, the app pool will automatically recycle.

Related

.NET Core Web App Restarting

I have a .NET core web app (console) hosted in IIS on a Windows machine. In the ConfigureServices method in Startup.cs I have a line of code which sends me an email so that I know when the service is restarted. When a new release is being deployed, I get that email, understandably. But I also receive that email at random times when there was no apparent restart of the machine, the app, or of any IIS component. Would there be any other thing which would cause it to restart? I'm not sure why this is happening.
Thanks,
IIS has a lot of settings for AppPool reset, like e.g. at given time, etc. You can check the advanced settings of your application pool that is set up to run your program and see if there is anything suspicious. It might be some inactivity timeout e.g.

Sharepoint farm solution recycle which application pool?

I have SharePoint Project which deploy as Farm Solution. I have multiple Web Application (SPWebApplication) in SharePoint. Each Web Application has dedicated application pool. I want to know if I deploy project as Farm Solution then all application pool recycles or particular one application pool will recycle ?
Only the application pool of your SharePoint project will recycle. Note that you define the site url in properties window of your project. Then when you deploy the project note that in "Output" window, you can see:
Recycle IIS Application Pool:
Recycling IIS application pool '<application pool name>'...
So just the application pool related to your site url will recycle.
Your farm solution can be deployed to multiple web applications. If that is the case then all web applications where the solution is deployed will recycle.
It's also important that you specify the -WebApplication parameter in your Install-SPSolution and Uninstall-SPSolution scripts, as they might otherwise recycle all web applications.

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

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

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.

How do I deploy a WCF service library to WAS?

I have created a WCF service library (not a WCF service application).
The project output is a dll.
How can I host this on IIS 7.5/WAS?
I believed that creating a service library was the way to go so that it could be used on a variety of hosts, whereas the service application is limited to IIS.
I'm getting lost in MS mumbo jumbo here, so I'd appreciate any help on getting this service deployed.
Thanks!
Edit
I got the service hosted by following these instructions:
http://msdn.microsoft.com/en-us/library/ms733109.aspx.
It seems like there has to be a better way to host service libraries. Deployment shouldn't require taking settings from app.config and moving them into web.config. Is it standard to wrap them in service applications? Is that even possible?
How are other people handling this?
Yes, creating separate library is good practice because hosting code is not coupled with your services. But you still have to write a host. In WAS, host is in a Web application. To host service in WAS you have to create .svc file and configuration for each service. That is the reason why you have to copy configuration from app.config to web.config. In .NET 4.0 this can be simplyfied with configuration based activation (no .svc is needed) end default endpoints.