4

My ServiceStack web service works fine in IIS Express (VS 2012) and when deployed to Windows Azure, but it does not work under IIS 8 on Window 8.

I am getting 404 Not Found Error. My web.config has both sections defined for IIS Express and the web server.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.web>
    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
      <buildProviders>
        <add extension=".cshtml" type="ServiceStack.Razor.CSharpRazorBuildProvider, ServiceStack.Razor" />
      </buildProviders>
    </compilation>
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
    </handlers>
  </system.webServer>
</configuration>

Solution:

Just figured out, through further research, that this resolved my problem:

  1. I switched the application pool to Integrated Mode.
  2. I added the following to web.config:

    <system.webServer>
      <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer>
    
Scott
  • 21,211
  • 8
  • 65
  • 72
h8tow8
  • 143
  • 9

1 Answers1

2

Repeating the solution as an answer, to make it clear what the issue was:


by doing some more searching i found 2 suggestions that resolved my problem:

  1. switched application pool to Integrated mode
  2. added the following to web.config

     <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/> 
    

mythz
  • 141,670
  • 29
  • 246
  • 390
  • there is something else I also noticed that i should mention about the problem. Once I update servicestack using nuget to a latest version the problem reappears again, but this time it is cause by the fact that reference to System.Web.Razor.Unofficial component get removed. To fix that I had to Install-Package System.Web.Razor.Unofficial package and add reference to that dll from the project. again I am using w8 and vs.net 2012, hope it will save some time to someone ;~) – h8tow8 May 17 '13 at 18:52
  • I've noticed sometimes NuGet updates don't work properly, i.e. they don't include all the libraries in the package. When this happens I manually delete all the NuGet references and packages and start from scratch again. – mythz May 17 '13 at 18:59
  • Same issue today. You saved my butt. Thank you. – Vasyl Boroviak Sep 20 '13 at 09:44