WCF .svc file served as plain text in IIS7.5 .NET 4.0 - Not under Default Web Site

admin

Administrator
Staff member
<strong>FINAL UPDATE</strong>: It turns out this was a red-herring due to a compression issue with a DotNetNuke module. I had to add to the PageBlaster DNN module, so this is no longer an issue.

I am deploying a WCF svc file to my <a href="http://www.pokerdiy.com" rel="nofollow noreferrer">live website</a> for the first time and it is rendering/served up to the browser as plain text. It works fine on my dev environment on localhost. You can see the problem here:

<a href="http://www.pokerdiy.com/test.svc" rel="nofollow noreferrer">http://www.pokerdiy.com/test.svc</a>

The website is running on <strong>IIS 7.5.7600.16385</strong> on <strong>Windows Server 2008 R2</strong> Version 6.1 SP1 (64 bit) in an <strong>Integrated Application pool</strong> with <strong>.NET 4.0</strong> (I am using Entity Framework 4.2).

<strong>UPDATE:</strong> On the live server, the site is added as a Website (ie. not under Default Web Site), whereas on my dev environment DotNetNuke is running as a Virtual Directory under the Default Web Site with it's own web.config (which I compared to the one on the live site and is identical).

Interestingly, when I am on the live server and I browse to the test.svc file in the DEfault Web Site then it works (<a href="http://localhost/Test.svc" rel="nofollow noreferrer">http://localhost/Test.svc</a>) - however, the one under the PokerDIY.com website does not (<a href="http://www.pokerdiy.com/test.svc" rel="nofollow noreferrer">http://www.pokerdiy.com/test.svc</a>). So it seems as though my Default Web Site is different to the additional websites somehow?

Another interesting thing: I removed all .svc Handler Mappings and now I can get the "HTTP Error 404.3 - Not Found" error. So the Handler Mappings are intercepting it, it's just not doing anything with it! I can get it back to static text by re-adding the .svc Handler Mappings.

After a lot of RTFMing, The first thing I checked was the Handler Mappings as per the MS article: all the svc mappings are there (svc-integrated is at the top as <a href="http://msdn.microsoft.com/en-us/library/ms752252(v=vs.90).aspx" rel="nofollow noreferrer">per this article</a>)

I also re-installed WCF as per <a href="http://grekai.wordpress.com/2011/03/10/http-error-404-3not-found-in-iis-7-5/" rel="nofollow noreferrer">this article</a> with no difference. Using Fiddler I can see that the Content-Type is "text/html"

What else can I try?

Note: ASMX webservices, ASP.NET files etc. all work fine.

<strong>Update</strong>: My Hosting Provider suggested I make the directory where the service resides into a Virtual Directory, which I did not have to do on my local machine in Dev. So now it uses the Parent websites appool and at leats it is doing something - it gets a different error. This does not sound correct though - why would it not be handled by the website appool? I moved the .svc into the root (<a href="http://www.pokerdiy.com/test.svc" rel="nofollow noreferrer">http://www.pokerdiy.com/test.svc</a>) to remove this from the equation).

Other things I have tried:
Changing modules runAllManagedModulesForAllRequests="false" to "true" (it is <strong>false</strong> in my web.config)
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir
<a href="https://stackoverflow.com/questions/5975816/wcf-in-iis-5-1-served-as-plain-text-file">WCF in IIS 5.1 served as plain text file</a>
<a href="https://stackoverflow.com/questions/4793127/404-when-running-net-4-wcf-service-on-iis-no-svc-file">404 when running .net 4 WCF service on IIS (no svc file)</a>