Hosting WCF service on IIS7.5, receiving 404.0 error

813 views Asked by At

I just received a new development laptop and now I can't get one of my WCF services running on the new laptop.

Windows 7 Enterprise

IIS 7.5.7600.16385

Windows Features Installed:

  • Internet Information Services
    • Web Management Tools
    • IIS 6 Management Compatibility
    • IIS Management Console
    • IIS Management Scripts and Tools
    • IIS Management Service
  • World Wide Web Services
    • Application Development Features (all sub-features)
    • Common HTTP Features
      • Default Document
      • Directory Browsing
      • HTTP Errors
      • HTTP Redirection
      • Static Content (all sub-features)
    • Health and Diagnostics (all sub-features)
    • Performance Features (all sub-features)
    • Security (all sub-features)
  • Internet Information Services Hostable Web Core
  • Microsoft .NET Framework 3.5.1 (all sub-features)
  • Windows Process Activation Service (all sub-features)

I dropped a simple "Hello World!" index.html file at the root of the WCF services application. I am able to serve that .html file. My services are under a sub-directory named "Hosts". I also dropped a simple index.html file under that sub-directory - I am able to serve that file as well. I cannot serve any of my .svc files though.

http://localhost/mywcfapplication/Hosts/IncidentService.svc

Anonymous Authentication -- "Application pool identity" is selected

The services are running in their own application pool. About the app pool:

  • .NET Framework Version: v2.0
  • Enable 32-bit applications: false
  • Managed Pipeline Mode: Classic
  • Identity: ApplicationPoolIdentity

I recently set these services up on a new Windows Server 2012 R2 web server in our test environment (old test server was decommissioned). On the server I had to give the app pool user permission to the directory in the file system (IIS_IUSRS\apppoolname), but my laptop doesn't seem to like this.

I'm receiving a 404.0 error when I attempt to browse to any of my .svc files under this application. IIS tells me the most likely causes are: •The directory or file specified does not exist on the Web server. •The URL contains a typographical error. •A custom filter or module, such as URLScan, restricts access to the file.

I have checked and re-checked the URL, and I can serve the .html files. I verified that the .svc files do exist. I'm at a loss. What have I overlooked?

Research:

IIS7.5 WCF Service - HTTP Error 401.3 (Even after adding IIS_IUSRS)

Hosting WCF service on IIS7.5

Windows 7 IIS7.5 and asp application Error HTTP 404.0 - Not Found

UPDATES:

6/8/15 - I added IIS AppPool\AppPoolName to the IIS_IUSRS group. No change.

6/9/15 -

  • I ran servicemodelreg -i. No change.
  • https://msdn.microsoft.com/en-us/library/ms752252(v=vs.90).aspx
    • Because I'm getting desperate, I ran aspnet_regiis –i –enable and then "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r
    • I also followed the steps listed "to verify that the svc file type is mapped correctly in IIS7.0"
  • HTTP 404 when accessing .svc file in IIS -- "We had a similar problem, and the SVC handler was already correctly installed. Our problem was the ExtensionlessUrl handler processing requests before they reached the SVC handler. To check this - in Handler Mappings in IIS Manager at the web server level, view the list of handlers in order (it's an option on the right-hand side). If the various ExtensionlessUrl handlers appear above the SVC handlers, then repeatedly move them down until they're at the bottom."
    • I verified that the extensionless handlers were at the bottom.
  • At the advice from yet another forum post I added a MIME type for .svc. No change.

6/15/2015 - - Log file: u_ex150615.log

1

There are 1 answers

0
MFedatto On

I got exactly the same issue and finally found a way through it.

The point is that WCF need a integrated pipeline to work properly. In Windows 7's IIS 7.7 I solved the problem by setting the Application Pool to use Integrated Pipeline mode (it was in Classic Mode). But Windows Server 2003's IIS 6 doesn't work with integrated pipeline, so Microsoft .Net uses Web Services Extensions, you could check at IIS 6, right above Web Sites. Ensure that the desired .Net version is allowed in Web Services Extensions. Than you need to register the Service Model extension.

Here´s what I did:

%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe -i