views:

5110

answers:

6

Hi,

Trying to get my wcf service running under IIS6.

I have created the .svc and aspnet_isapi.dll mapping according to: http://msdn.microsoft.com/en-us/library/ms752241.aspx

When viewing the Server1.svc page, I am getting a 404.

I have tested the site with a simple .aspx page to ensure the url is working, but again the .svc extension isn't.

I have .net 3.5 SP1 installed, my web.config is referencing 3.5 assemblies and I don't get an error when viewing a .aspx page so it is picking those assemblies up fine presumably.

What could be wrong?

A: 

You say you configured the extension, did you do an IIS reset afterwards?

Also are you doing any URL rewriting which could be taking you somewhere else?

Jason Stevenson
no url rewriting. I stopped and started the IIS website, is that what you mean?
Blankman
ok restarted iis, still not working.
Blankman
+1  A: 

I don't think it is the issue but is your app configured for .net 2.x (instead of 1.x by default) in IIS6?

yes has .net 2.x selected.
Blankman
+3  A: 

There are two things I can think of:

The .svc extension is not correctly set up (least probable according to your description). You can check this post for more details.

Or your web site has multiple host headers. To resolve this issue, you must have a single host header or use a factory. Here’s an example:

namespace MyNamespace
{
    public class MultipleHostServiceFactory : ServiceHostFactory
    {
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            List<Uri> addresses = new List<Uri>();
            addresses.Add(baseAddresses[0]);
            return base.CreateServiceHost(serviceType, addresses.ToArray());
        }
    }
}

Next, you need to set the factory in the markup of your .svc file:

<%@ ServiceHost Language="C#" 
                Debug="false" 
                Factory="MyNamespace.MultipleHostServiceFactory" 
                Service="MyNamespace.MyService" 
                CodeBehind="MyService.svc.cs" %>
Darin Dimitrov
there are no host headers from what I can see, just using the IP
Blankman
You may have not solved the OP's issue, but you got mine!
RSolberg
+7  A: 

More than likely .svc extension is not registered under IIS as being handled by ASP.NET(WCF)

Try these 2 steps (replace Framework with Framework64 if it's needed):

Go to:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\
and then run:
aspnet_regiis -i

Go to:
C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation
and then run:
ServiceModelReg.exe -i

Pawel Pabich
This worked for me! Thanks
Harry
This was a life saver! I only had to run "aspnet_regiis" and it fixed it.
Chris Pietschmann
if you run -i wont that "break" all prior .net installations? our entire website is running .net 1... I need to get wcf working. should I run with -i flags? I dont want to change any existing stuff.
BabelFish
+3  A: 

Under Internet Information Service (IIS) Manager, open the node called Web Service Extension. Make sure that ASP.NET v2.0.5.0727 is set to Allowed. I spent hours looking for different settings and found it was set to Prohibited. Just click Allow button to enable ASP.NET.

eed3si9n
+1  A: 

I had the same problem -- it ended up being I was running a 64 bit version of Windows 2003 server, and had my assemblies configured for "Any CPU" -- once I changed the assemblies over to x86 and uploaded to the server, everything worked.

I dont know why nobody has mentioned it anywhere else in the 30 threads I read about -- but my friend recommended it to me, and it worked like a charm.

Just throwing it out there just incase someone has the same issue.