servicestack hello无法加载http处理程序

时间:2013-02-11 19:40:59

标签: macos mono servicestack xsp

我正在关注ServiceStack.net上的Hello Web服务教程。我在尝试访问该服务时收到以下消息:

无法加载httpHandler类型`ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,ServiceStack'

我正在使用xsp,我在工作目录中为项目启动了默认值(即:端口8080)。我编辑了该目录中的web.config,如教程中所述。

服务如何找到http处理程序?在端口8080上使用xsp,我可以打开元数据页吗?

与应用程序位于同一目录中的web.config包含:

<configuration>

    <!-- Required for MONO -->
  <system.web>
    <httpHandlers>
      <add path="servicestack*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/>
    </httpHandlers>
  </system.web>
  <!-- Required for IIS7 -->
  <system.webServer>
    <!-- ServiceStack: Required -->
    <validation validateIntegratedModeConfiguration="false"/>
  </system.webServer>

</configuration>

2 个答案:

答案 0 :(得分:2)

如上所述,我正在使用Mono和xsp。我现在意识到,在我的工作目录中,MonoDevelop不仅创建了web.config,还创建了一个bin目录,其中包含我在项目中创建和引用的所有dll。

将xsp根目录设置为包含web.config和./bin的路径,启用了http处理程序,并允许我最终访问我的Web服务和
 http://localhost:8080/ServiceStack/metadata

在这种情况下,我不需要我的dll在/ bin中,而是在项目的bin中

我也忽略了对HelloAppHost()的调用.Init()

学习曲线的一点......但我期待着使用ServiceStack。

谢谢@mythz和@ Mr.Young

答案 1 :(得分:1)

我认为您的配置可能不正确。您可能已将配置与使用ServiceStack和现有Web框架的配置混淆。 在没有任何其他Web框架的情况下在根(/)路径上托管ServiceStack的基本配置是

<system.web> 
   <httpHandlers> 
      <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> 
      </httpHandlers> 
</system.web>

servicestack*和IIS特定内容中删除path。您可能会遇到虚拟路径的Mono ASP.NET实现中的非常不酷的错误,详情请参阅:https://groups.google.com/d/msg/servicestack/kzfS88RldIU/LsJ2jV9M2LIJ