在Service Stack 3.9中配置web.config无法正常工作

时间:2014-11-11 17:19:00

标签: web-services servicestack servicestack-bsd

我正在关注ServiceStack教程,但我使用的是版本3.9.71并修改了web.config,这给了我错误。我的代码是这样的:

<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>

1 个答案:

答案 0 :(得分:1)

这是 ServiceStack v4 的配置,ServiceStack v3(BSD)的文档维护在:https://github.com/ServiceStackV3/ServiceStackV3/

Create your first Service教程显示了有效的v3配置:

<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>