I've been reading the documentation on IIS settings, and haven't been able to find much on the MSDN site. I'm trying to figure out the preferred settings for a WCF REST service hosted in IIS6. Main goals of these settings should be reliability, restarting the service when needed, and max throughput.
My service will use some processing power as its converting back and forth from XML, of course. Suggestions, or suggested URLs to read?
Thanks.
I've started to find some answers to my own question. I'll post everything I find here.
Internet Information Services Hosting Best Practices
System.ServiceModel namespace
serviceHostingEnvironment
How to do away with the .svc file
Related
It seems NServiceBus is moving from configuration to Code. What are the additional benefits of hosting using NServiceBus.Host.exe vs hosting an endpoint yourself?
Not sure what configuration via code has to do with hosting?
The NServiceBus Host offered features to make it easier to host your endpoints. Since then we have made a lot of this stuff easier or the features have been added to specific packages. So at the moment, it's as easy to host it yourself. And you'd have more control over setup, etc. For example the host has its own configuration and the endpoint itself as well. Some users have issues with assembly mappings that need to be in both places, etc.
So if you want to know how you can host yourself, there's documentation on that:
General hosting
Self hosting sample
Windows Service Hosting
Web Application Hosting
Service Fabric Hosting
Shared Hosting in Azure
and much more on our documentation website.
One of our teams here has just completed a project using both WCF and
NServiceBus. When I reviewed the project I found that they had chosen to host
the WCF services and NServiceBus in IIS instead of NServiceBus host.
When I queried as to why this was I was told that when they hosted WCF services
(on TCP binding) in the NServiceBus Host that the WCF would regularly 'get
stuck'. What this meant in practice that usually around once a day the WCF
service would start actively refusing connections.
It is my understanding that IIS has custom code inside it to monitor the health
of the WCF endpoints and restart them when they 'get stuck'. I would like to
avoid hosting in IIS though as you don't get all the convention based goodness
of using NServiceBus host.
Can anyone shed any more light on this issue or suggest ways we might be able to
avoid the issue while using the NServicebusHost?
PS I Realise the description of the problem is a little vague I'm also hoping someone might be able to help me improve the question.
I can't understand the need to host everything in one container. Can't you host your WCF endpoints in IIS and your NSB endpoints via the generic host in a windows service. Then they can be managed as separate concerns.
My head hurts so much I think I need a bottle of aspirin...
I've created a WCF service and, with help of others from this site and the department I work in, the WCF service is running as a service on my development machine. Tested it with a console app and it works.
But, it's not supposed to be on my development machine. It needs to be on a different server.
This is difficult because the server it is supposed to reside on DOES NOT have Visual Studio installed on it.
So I cannot run the VS 2008 Command Prompt with installutil to run the WCF service as a service on that server.
Broadly speaking, you've got three options, all of which are described on MSDN:
Host the service under IIS
Self-host the service in any managed .NET application
Host the WCF service under a Windows Service
Which one is right for you depends on what your service is for, how it'll be consumed, how scalable and secure you need the set-up to be, and a dozen other things besides. Without knowing a bit more about what your service does and how it'll be used in your organisation, it's difficult to make a recommendation.
IIS hosting is easy to set up and is the way to go if you want to leverage all of the industrial-strength hosting functionality that a full-blown web server offers.
Self-hosting is quick and easy - you can knock out a WCF-hosting console app in two minutes flat - but is the clunky solution. You of course have to run the host application as a particular Windows user. Perhaps not ideal?
Hosting under a Windows service is the middle ground. It gives you that always-available functionality without having to be logged in as a specific user, but doesn't offer the configurability and scalability of the IIS solution. It takes a bit more effort than belting out a quick console app, but not much.
The server that the windows service will reside on will have the .NET Framework. INSTALLUTIL is located in the Microsoft.NET\Framework(version number) folder in the Windows directory.
For example, C:\Windows\Microsoft.NET\Framework\v2.0.50727.
No need to write a console app to host your service now (unless you want to).
You can also host your WCF service under IIS, check this out: MSDN - How to: Host a WCF Service in IIS. It really is just a five minute job :)
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.
I have built a simple WCF Service and deployed it to IIS6, and I'm noticing that it works in my Dev and Staging environments, but not Production. Every time I try to hit the service metadata link, I get a 404 page.
I've checked IIS config everywhere I can think of and they're identical, so the only difference I can think of is that the Production environment is load balanced.
Does anyone know of any issues with running a WCF service behind a load balancer, and how can I get around that? Am I on the wrong track, is there another common problem I should look into?
You need to setup wild card mapping on IIS6. This link seems like a good step by step guide.
Try reading up on the differences between the integrated pipeline vs classic pipeline on IIS7
For me .svc was already mapped to the aspnet_isapi.dll as per AnthonyWJones answer:
I kept getting 404's and nothing in the logs (C:\WINDOWS\system32\LogFiles\W3SVC1) helped, all my WCF settings and web.config were textbook examples. I triple checked all the permissions...
What my problem turned out to be was that I had built my WCF service in .Net 4.0, after I installed ASP.net 4.0 using aspnet_regiis -i -enable it worked straight away: