2012-02-16 26 views
2

我在配置我的ServiceStack REST服务以在我的生产IIS 7.5框上工作时遇到问题。它工作正常运行本地主机,它也工作正常,如果我部署在“默认网站” -/EmployeeSvc的根。为了组织目的,我在Default Web Site下有一个虚拟目录结构(注意web.config中的自定义路径)。我可以成功浏览到此位置的default.htm,但是当我尝试执行我收到的内置/ hello示例时:ServiceStack REST服务自定义路径错误

服务器错误404 - 找不到文件或目录。 您正在查找的资源可能已被删除,名称已更改或暂时不可用。

就像我说过的,内置/ hello示例完全可以从本地主机和默认web站点下的根iis文件夹完成,但不能从目录结构中完成。我在做什么错误的位置路径?

在此先感谢!这里是web.config中:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 

    <location path="Employees-NoAuth/WebServices/EmployeeSvc"> 
     <system.web> 
      <httpHandlers> 
      <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" /> 
      </httpHandlers> 
     </system.web> 

     <!-- Required for IIS 7.0 --> 
     <system.webServer> 
      <modules runAllManagedModulesForAllRequests="true"/> 
      <validation validateIntegratedModeConfiguration="false" /> 
      <handlers> 
      <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" verb="*" /> 
      </handlers> 
     </system.webServer> 
    </location> 

    <system.web> 
    <customErrors mode="RemoteOnly"/> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 

</configuration> 
+0

注:“服务器错误404 - 文件或目录未找到”是一个ASP.NET错误,即你的路径是不是做对ServiceStack处理程序 - 这是需要解决的第一件事。 – mythz 2012-02-16 18:30:50

+0

我对servicestack很新,​​但是你有没有机会在你的web.config中增加system.webServer条目?沿着ria服务使用服务堆栈时遇到了同样的问题。如果你确实让我知道,我会告诉你该怎么做。 – epitka 2013-03-22 13:52:28

回答

0

我会尝试以下方法:从web.config中
1.拆下位置节点。移出SS配置。在类
2.注册基本URL路径从AppHostBase得出:

public override void Configure(Container container) 
{ 
    this.SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "base/path" }); 
}