IIS 7 gives 404.17 error with svc WCF services

If you try to access a svc service hosted in IIS and you get the following error:

HTTP Error 404.17 – Not Found – The requested content appears to be script and will not be served by the static file handler.

the cause is most likely misconfigured handler mappings for the svc file extension. The correct mapping for the svc file depends on the application pool's .NET version and managed pipeline mode.

There is an easy way to restore the correct mapping for the svc file extension. If you're using .NET 2.0 in your pool, you can run the command “ServiceModelReg.exe -i” from the folder “C:WindowsMicrosoft.NETFrameworkv3.0Windows Communication Foundation”. If you're using .NET 4.0, you can run the command “aspnet_regiis.exe -i” from “C:WindowsMicrosoft.NETFrameworkv4.0.30319”.

There's a catch here. If your IIS hosts both .NET 2.0 and .NET 4.0 sites, .NET 4.0 settings will disappear as soon as you run the ServiceModelReg.exe command and your .NET 4.0 site won't work anymore. If that's the case, make sure you run first the ServiceModelReg.exe command and after that's done run the aspnet_regiis.exe.

Advertisements

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s