web-servicesservicestackservicestack-bsd

Configuring web.config in Service Stack 3.9 not working


I'm following a tutorial ServiceStack but I use version 3.9.71 and modify the web.config gives me error. My code is like this:

<configuration>
  <system.web>
    <httpHandlers>
      <add path="*" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*"/>
    </httpHandlers>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

  <!-- Required for IIS 7.0 (and above?) -->
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
    </handlers>
  </system.webServer>
</configuration>

Solution

  • That is the configuration for ServiceStack v4, the documentation for the ServiceStack v3 (BSD) is maintained at: https://github.com/ServiceStackV3/ServiceStackV3/

    The Create your first Service tutorial shows the valid v3 configuration:

    <system.web>
      <httpHandlers>
        <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/>
      </httpHandlers>
    </system.web>
    
    <!-- Required for IIS 7.0 (and above?) -->
    <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>