WCF Service hosted in IIS6 gets 404 in Production - wcf

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:

Related

how can I test a WCF service using XAMPP to work with Apache server?

I built a WCF service on a windows virtual machine, and tested it with the WCF test client by typing this on my browser:
http://localhost/Service1.svc/getAllCustomers
... and it works pretty good. Now the problem is that I want to do the same test in my real computer (not the VM).
I'm using XAMPP on the VM, I have set the project on the htdocs folder, and I type this on my browser:
http://10.211.55.3/WCFWebService/Service1.svc.cs/getAllCustomers
The problem is that it doesn't return the result of calling getAllCustomers, instead it returns the Service1.svc.cs in plain text.
I want it to do the same thing it does on the VM - can someone tell me what the problem is? I think it's because on the VM it works with the WCF test client, and since my computer is a Mac I can't run the WCF test client.
A WCF service can't run on an Apache web server instead you should install IIS Server on the VM in order to test the service.
Refer to this: http://msdn.microsoft.com/en-us/library/ms733766.aspx
I found this with a Google query.
I kept the tab open, but continued exploring the other search results.
One I found particularly interesting was this one: WCF acting as Web Service without IIS
It appears WCF gives options other than IIS to host the web service (Console Application, Windows Application, Windows Services).
The Windows Service link is provided here: How to: Host a WCF Service in a Managed Windows Service
I have not done this, so I cannot elaborate on what problems you will run into.
I just want others that may run into this (like I did) to know that the one answer posted last year may not actually be the end of the road.

Unable to host WCF REST Service 40(CS) on IIS 7

I have created WCF REST service in vs2010(4.0) with WCF REST Service Template 40(CS). It works fine on localhost and local IIS (7.5), without giving me any errors. But while I am trying to deploy it on server, it gives me 500 Internal server error. I have deployed same way I did on locl IIS. It is not giving me more details about the error. When I checked the server log, it says service.svc - file does not exist. While I have not created .svc file, I did directly with given template.
Can any one please help me to find the solution to this...
Thanks in advance...
I am using template, so there is no .svc file. In this we can directly access the uri without .svc with the filename.
Chrome is just displaying me 500 Internal server error. It is not displaying any related information about error.
-
Satyen Pandya
finally I found the thing that causes error in my service. I have used MySQL database and for that reference to MySql.Data.dll file of older version, and when I upgraded that dll with newer version, my entire project was not responding. It was replaced my newer version and when I tested with older version, service is running fine.
And for hosting it on WCF, Normal procedure of hosting the site on IIS worked for me after solving above problem... And I better opt for going with .net 3.5 WCF Rest Service with .svc extension available.
Thanks all for reviewing my problem..
Take a look at similar post...
# hosting .net 4.0 REST WCF service in IIS 6

Hosting of WCF and Windows Services

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 :)

WCF Service doesnt run on IIS!

I have a WCF service hosted at local IIS. I created a ASP.NET website that consumes this service hosted at IIS.
While running it from Visual Studio WebDev Server, everything works fine, but as soon as i run the same website [after hosting in IIS] from the browser, the website doesnt seem to be communicating with the Service!
The same setup when runs from Visual Studio WebDev Server, doesnt function from IIS!
Any know isues?
Please help!
Thanks
I bet it's the address - when using Add Service Reference it will hardcode "localhost" into your ClientConfig file on the client.
Check this and implement a way to change over to your real (IIS) address at deploy time.
(A way to check you have the right deploy-time address is to pull it up in a browser, try navigating to "http://yoururl.com/MyService.svc" you should get a page that will link to the WSDL, letting you make sure you have the right address.. this is the address your client should look for)
Couple of things to check:
do you have a SVC file? Where is it located?
do you connect to the correct service address? It would be:
http://YourServerName/YourVirtualDirectory/YourServiceFile.svc
This is the address that you get when hosting in IIS - you cannot override that in your web.config, no matter how hard you try.
are the configurations for binding etc. identical on server and client?
have you turned on HttpGetEnabled for the service metadata? Can you navigate to the WSDL address and get the WSDL back??
http://YourServerName/YourVirtualDirectory/YourServiceFile.svc?wsdl
It sounds like you are not resetting the Service reference when you move it to the webserver. What you need to do after you have completed testing is to move your Service to be hosted by IIS, so deploy it to the server. Then you will need to re-reference, or update your reference in our web app before you deploy it.
Typically when testing your service it will run in the dev server at http://localhost:someport/myservice.svc
When you deploy it to IIS it will run on http://myserver.com/PossibleVDIR/myservice.svc
Once you take care of this you should be fine.

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...