WCF .SVC 404.3 W2K8 IIS7 Fix

That’s a fun title, eh?  Let’s see if the keywords improve on it.

Keywords: Service SVC is undefined, SVC 404 Not Found, AJAX WCF JQuery, SVC file 404.3, SVC in browser, Windows Server 2008 and WCF, IIS7

No, guess not.

I finally began my trip down JQuery Road, thinking it will be a useful tool in conjunction with WCF for some cool Sueetie v.Next functionality.  I spent hours trying to connect JQuery with a WCF .SVC service on my Sueetie development site, so hopefully sharing my solution will help someone else.

The problem was compounded by the fact that while investigating Rick Strahl’s excellent JQuery sample solution using the Visual Studio Web Server, JQuery and WCFs worked perfectly.  So I became sidetracked thinking it was an IIS7 binding issue to http://sueetie on my standalone Windows 2008 Server. 

I banged my head against a "’SueetieService’ is Underfined" error for the longest time.

Then, thanks to Fiddler 2, I discovered that I was getting a 404 when trying to browse the .SVC file, as in http://sueetie/SueetieService.SVC.  Again, I could browse .SVCs in Rick Strahl’s project using the Visual Studio Web Server just fine. 

It turned out that my solution was adding WCF Activation in Windows Server 2008’s Features for .NET Framework 3.0 as shown below.

 

Afterward, browsing to http://sueetie/SueetieService.svc worked successfully.

 

For completeness sake, here is my working <system.serviceModel /> web.config area.

 

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="SueetieServiceAspNetAjaxBehavior" >
                <serviceDebug includeExceptionDetailInFaults="true" />
                <serviceMetadata httpGetEnabled="true" />
            </behavior>
        </serviceBehaviors>
        <endpointBehaviors>
            <behavior name="SueetieServiceAspNetAjaxBehavior">
                <enableWebScript />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>
        <service name="SueetieService"
            behaviorConfiguration="SueetieServiceAspNetAjaxBehavior">
            <host>
                <baseAddresses>
                    <add baseAddress="
http://sueetie/SueetieService.svc"/>
                </baseAddresses>
            </host>
            <endpoint address="
http://sueetie/SueetieService.svc"
                behaviorConfiguration="SueetieServiceAspNetAjaxBehavior"
                binding="webHttpBinding"
                contract="SueetieService" />
        </service>
    </services>
</system.serviceModel>

 

There!  Hopefully that will save someone else a few hours a head-banging finding their way into the light with JQuery and WCF.

Article written by

A long time developer, I was an early adopter of Linux in the mid-90's for a few years until I entered corporate environments and worked with Microsoft technologies like ASP, then .NET. In 2008 I released Sueetie, an Online Community Platform built in .NET. In late 2012 I returned to my Linux roots and locked in on Java development. Much of my work is available on GitHub.